I've been trying to fix this for hours, i'm a beginner at this stuff
LocalScript:
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local mouse = plr:GetMouse()
local tool = script.Parent
local anim = tool:FindFirstChild("PunchAnimation")
local Debounce = true
local Damaged = false
char:WaitForChild("LeftHand").Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not Debounce and not Damaged and hit.Parent.Humanoid ~= plr.Character.Humanoid then
if plr.Character.Humanoid.Health > 0 then
Damaged = true
game:GetService("ReplicatedStorage").RemoteEvents.punch
:FireServer(hit.Parent.Humanoid)
end
end
end)
tool.Equipped:Connect(function()
print("A tool was equipped")
mouse.Button1Down:Connect(function()
print("Tool clicked")
local hum = tool.Parent:FindFirstChild("Humanoid")
if hum and Debounce then
Debounce = false
anim = hum:LoadAnimation(tool.PunchAnimation)
anim:Play()
wait(0.5)
Debounce = true
end
end)
end)
ServerScript:
game:GetService("ReplicatedStorage")
.RemoteEvents.punch.OnServerEvent:Connect(function(player, humanoid)
if humanoid.Health >= 0 then
humanoid.Health = humanoid.Health - 10
elseif humanoid.Health < 0 then
humanoid.Health = 0
end
end)

5 comments
yes i get it but how do you fix it, ik that i should't trust the client but im still learning all this stuff and these remote events are the most difficult things for me
Hmm I guess try FindFirstChild? This is very odd as you checked for the Humanoid beforehand but, trying it won't hurt I guess.?
Also, regularly you would want to do the animation on the Client then on the Server you'd want to do damage.
Which means just do the .Touched function on the Server even though I don't recommend using .Touched for this.
tried to put hit.Parent:FindFirstChild("Humanoid") in the fireserver but didnt work same error WaitForChild aswell