wait(.2)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local RightArm = Character:WaitForChild("RightArm")
RightArm.Touched:Connect(function(hit)
local hum = hit.Parent:findFirstChild("Humanoid")
if hum and not Humanoid then
hum:TakeDamage(10)
end
end)
✓ ANSWER ACCEPTED
Why won't the humanoid take ten damage?
1 answer
✓ Accepted answer
Use Remote Events! Because your game has Filtering Enabled! The client cannot communicate server unless with the use of remote events. To use it go to ReplicatedStorage and add a remote event. Add a server script in ServerScriptService. And copy these lines.
At the local script
-- Local Script
wait(0.2)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local RightArm = Character:WaitForChild("RightArm")
local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- Defining the remote event at the ReplicatedStorage
RightArm.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and not Humanoid then
RemoteEvent:FireServer(hum, 10)
end
end)
At the server script
-- Server Script(Normal Script)
local RemoteEvent = game.ReplicatedStorage.RemoteEvent -- Defining the remote event at the ReplicatedStorage
RemoteEvent.OnServerEvent:Connect(function(plr, hum, dmg)
hum:TakeDamage(dmg)
end)
I hope it helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Next time I reccomend saying more than just the code itself.