can anyone can help me about keybutton cause i don't it's gonna be key "f" Sorry For my grammar
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local dmg = true Mouse.KeyDown:connect(function(key) if key == "f" then local an = script.Parent.Humanoid:LoadAnimation(script.Animation) an:Play() script.Parent.RightHand.Touched:connect(function(hit) if hit.Parent.Humanoid and dmg == true then hit.Parent.Humanoid:TakeDamage(10) dmg = false wait(1) dmg = true end end) end end)
Well i can't really test it cause i don't have time and i'm tired, going to sleep but here test this out
Fixed script
(localscript)
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local dmg = true Mouse.Button2Down:Connect(function() local an = script.Parent.Humanoid:LoadAnimation(script.Animation) an:Play() script.Parent.RightHand.Touched:connect(function(hit) if hit.Parent.Humanoid and dmg == true then game.ReplicatedStorage.punch:FireServer(hit.Parent.Name,10) dmg = false wait(1) dmg = true end end) end)
(serverscript)
game.ReplicatedStorage.punch.OnServerEvent:Connect(function(sender,who,damage) workspace[who]"Humanoid":TakeDamage(damage) end)