I made this punch script when the player clicks their mouse but it does no damage, I put the punch script in a Local Script and the Damage Script in a regular script. I did this because when I had them in one script it would only work for the local player. Please help!

Damage script:

plr = script.Parent.Parent.Parent
char = plr.Character

local damage = 5

local swing = script.Parent:WaitForChild("Swing").Value

char:WaitForChild("Right Arm").Touched:connect(function(hit)
	if swing.Value == true then
		local hum = hit.Parent:FindFirstChild("Humanoid") 
		if hum ~= nil then
			print("Hurting "..hit.Parent.Name.."!")
			hum.Health = hum.Health - damage
			--hum:TakeDamage(damage)
			hum.WalkSpeed = 0
			wait(.6)
			hum.WalkSpeed = 16
		end
	end
end)
--------------------------------------------------------------------------

2 comments

0

Is FE on?

0

Yes