Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

my punch script plays the animation and sound but doesn't do damage any ideas?

Asked by 4 years ago
Edited 4 years ago

i fixed it so it does damage but now it does constant damage when a player touches another players right arm any ideas on how to fix this? (its r15)

game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(Char) local sound = game.ServerStorage.Punch:Clone() sound.Parent = Char:WaitForChild("Head") end) end)

game.ReplicatedStorage.Punch.OnServerEvent:Connect(function(player) local char = player.Character or player.CharacterAdded:wait() local rarm = char:WaitForChild("RightHand") rarm.Touched:connect(function(hit) local dmg = true local hum = hit.Parent:FindFirstChild("Humanoid") if hum then dmg = false hum:TakeDamage(5) wait(0.5) dmg = true end end)

player.Character.Head.Punch:Play()

end)

1 answer

Log in to vote
0
Answered by 4 years ago

Well you could take an easy way out and make an instance that does damage on hit at the end of the fist using Instance.new("Part", --Whatever your fist is) then use a debounce to make it hit on the time you need it, but like i said this is an easy way out, and i don't know how to make damaging punches, hope this helps.

Ad

Answer this question