local DamgePart = script.Parent.DamgePart
local Click = script.Parent.DamgePart.Click
local Animation = script.Animation
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Lplr,Damge)
local Humanoid = script.Parent.Parent.Humanoid
local A = Humanoid:LoadAnimation(Animation)
Click.Value = true
A:Play()
DamgePart.Touched:Connect(function(plr)
if Click.Value == true then
if plr.Parent == Lplr or plr.Parent:FindFirstChildOfClass("Players") == Lplr then
print("its me")
else
local plr = plr.Parent:WaitForChild("Humanoid") or plr.Parent:FindFirstChildOfClass().Humanoid
if plr then
plr.Health = plr.Health - Damge
Click.Value = false
end
end
end
end)
end)
1 Like
Is a normal script? the remote at least fires? you are calling that remote from a local script?
Just use the first argument got by the remote which is the player, and load the animation into the Animator not the Humanoid:
local DamgePart = script.Parent.DamgePart
local Click = script.Parent.DamgePart.Click
local Animation = script.Animation
script.Parent.RemoteEvent.OnServerEvent:Connect(function(Lplr,Damge)
warn("remote fired by:", Lplr)
local A = Lplr.Character.Humanoid.Animator:LoadAnimation(Animation)
Click.Value = true
A:Play()
DamgePart.Touched:Connect(function(plr)
if Click.Value == true then
if plr.Parent == Lplr or plr.Parent:FindFirstChildOfClass("Players") == Lplr then
print("its me")
else
local plr = plr.Parent:WaitForChild("Humanoid") or plr.Parent:FindFirstChildOfClass().Humanoid
if plr then
plr.Health = plr.Health - Damge
Click.Value = false
end
end
end
end)
end)
Maybe you dont want to animate the player, you want to animate a NPC? idk, you dont supply details, just make sure you are loading into the Animator of the NPC then
1 Like