ifDmg = true
Keyting = "e"
amountdmg = 10
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.KeyDown:Connect(function(key)
if key == Keyting then
local anim = script.Parent.Humanoid:LoadAnimation(script.Animation)
anim:Play()
anim.Looped = false
script.Parent.RightHand.Touched:Connect(function(hit)
if hit.Parent.Humanoid and ifDmg == true then
hit.Parent.Humanoid:TakeDamage(amountdmg)
ifDmg = false
wait(1)
ifDmg = true
end
end)
end
end)
Above is my script used to make the punching work but I was trying to make
mouse.KeyDown:Connect(function(key)
as a server sided, instead of it being client sided
and...
I dont know really on how to do that since the script has a parameter...
If there is anyway to make the script into a remote event, please answer or comment because it will help out..
thanks!

1 comment
By the way :KeyDown is deprecated use UserInputService