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
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
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…