What I wanted to do with my sword script is to damage Humanoids on touch. I also wanted it so that when the Humanoid it is touching dies, it fires a remote event. However when I try it, it doesn't work!
Here is my script:
local db = true
local tool = script.Parent.Parent
script.Parent.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
if db == true then
if humanoid.Health > 0 then
humanoid:TakeDamage(34)
script.Parent.Hit:Play()
if humanoid.Health <= 0 then
game.ReplicatedStorage.RemoteEvent:FireClient(tool.Parent)
end
db = false
wait(0.45)
db = true
end
end
end
end)
Thank you!

1 comment
As stated u can only pass a argument as player when firing from the local script just make it a player.