Localscript not working

I want a script for a part that when touched, only damages the player on the client. It doesn’t seem to be working. How should I fix this? (this script is a localscript by the way)

function onTouched(hit)
local human = hit.Parent:findFirstChild(“Humanoid”)
if (human ~= nil) then
human.Health = 0
script:Destroy()
end
end

script.Parent.Touched:connect(onTouched)

Im gonna tell you this, DO NOT DO THIS ON THE CLIENT. Any form of data type should be handled on the server. If you only damage the player on the client, all players will still see them as if they were alive, except they wont be they would have died, and it just causes a LOT of problems so please please please do it on the server

I wouldn’t recommend doing this on the client. However, assuming the part is parented to the workspace, try parenting the kill part to the player.

That’s kind of the point. I want other players to see them as alive.

Like them alive at all times? Cause they wont be able to see them die, or anything like it, if the player dies on the client, for every other client, their old body will still be there and their new one wont so do it on the server, itll help with a lot of stuff

Just create the script on the server and fire a remote event to the client when a player touches it to kill them. It’s better to handle touched events on the server anyway…

I tried to before, but it wasn’t working for some reason.