this is my first time working with filtering enabled, ive made a few small games in the past but nothing good
i made a text button gui that when clicked should kill the player. This is what im having trouble with. (feel free to call me a noob) but i cant seem to figure out how to make it function as it should, here's the script.
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function() local LocalPlayer = game.Players.LocalPlayer LocalPlayer.Health = 0 end)
i know its sad i cant get the simplest function to work but eh i guess we all start somewhere
thanks for the help in advance!
Server scripts can't access localplayer. It needs a p (additional argument in fe) in the argument/player in the argument. For more info, view the robloxwiki or youtube videos. You're welcome. And, btw you missed to define the character then the humanoid. Humanoid holds all the properties of the character.
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(p) ---[[ in the argument, defines plr]] local char = p.Character -- gets character local hum = char:WaitForChild("Humanoid") -- gets humanoid hum.Health = 0 -- This will make the hum's health zero end)