Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local plr = game.Players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- local replicatedStorage = game.ReplicatedStorage
- local combatEvent = replicatedStorage.RemoteEventStorage:WaitForChild("combatEvent")
- local swordCombatEvent = replicatedStorage.RemoteEventStorage:WaitForChild("swordCombatEvent")
- local swordDrawEvent = replicatedStorage.RemoteEventStorage:WaitForChild("swordDrawEvent")
- local swordSheathEvent = replicatedStorage.RemoteEventStorage:WaitForChild("swordSheathEvent")
- local damageCombatEvent = replicatedStorage.RemoteEventStorage:WaitForChild("damageCombatEvent")
- local combatDebounce = false
- local qDebounce = false
- local swordCombatNum = 1
- local handCombatNum = 1
- game:GetService("UserInputService").InputBegan:connect(function(key, isTyping)
- if isTyping then return end
- if key.UserInputType == Enum.UserInputType.MouseButton1 then
- if combatDebounce == false and qDebounce == false then
- combatDebounce = true
- if char.Equipped.Value == "Hands" then
- local hitbox = combatEvent:InvokeServer(handCombatNum)
- handCombatNum = handCombatNum + 1
- if handCombatNum == 4 then
- handCombatNum = 1
- end
- ----
- hitDebounce = false
- hitbox.Touched:connect(function(hit)
- if hitDebounce == false then
- if hit.Parent then
- local hitChar = hit.Parent
- if hitChar ~= char then
- local hitHuman = hitChar:FindFirstChild("Humanoid")
- if hitHuman then
- hitDebounce = true
- print("Contact")
- local hitPlr = game.Players:GetPlayerFromCharacter(hitChar)
- if hitPlr then
- print("Player")
- damageCombatEvent:FireServer(hitChar, 20)
- else
- print("NPC")
- damageCombatEvent:FireServer(hitChar, 20)
- end
- end
- end
- end
- end
- end)
- ----
- wait(1)
- elseif char.Equipped.Value == "Sword" then
- --Anim Choose Stuff Here
- local hitbox = swordCombatEvent:InvokeServer(1)
- ----
- hitDebounce = false
- hitbox.Touched:connect(function(hit)
- if hitDebounce == false then
- if hit.Parent then
- local hitChar = hit.Parent
- if hitChar ~= char then
- local hitHuman = hitChar:FindFirstChild("Humanoid")
- if hitHuman then
- hitDebounce = true
- print("Contact")
- local hitPlr = game.Players:GetPlayerFromCharacter(hitChar)
- if hitPlr then
- print("Player")
- damageCombatEvent:FireServer(hitChar, 25)
- else
- print("NPC")
- damageCombatEvent:FireServer(hitChar, 25)
- end
- end
- end
- end
- end
- end)
- ----
- wait(1)
- end
- combatDebounce = false
- end
- --[[elseif key.KeyCode == Enum.KeyCode.Q then
- if qDebounce == false then
- qDebounce = true
- if char.Equipped.Value == "Hands" then
- swordDrawEvent:FireServer()
- elseif char.Equipped.Value == "Sword" then
- swordSheathEvent:FireServer()
- end
- wait(1)
- qDebounce = false
- end]]
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement