Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to kill a player if touched by another player?

I am stumped trying to figure it out how to do this

1 comment

0

uhh do you have any attempts??

1 answer

i tried this

local player = game.Players:GetChildren() local giant = player[math.random(1, #player)]

giant.hit:Connect(function() player.Character.Humanoid.Health = 0 end)

4 comments

0

apart from this i dont know what to do

0

hmm you should do game.Players:GetPlayers() but get children can work but its kinda outdated and hard to understand, If its on a server script then do :TakeDamage() on the humanoid. and you should do giant.Character.HumanoidRootPart.Touched:Connect() cause you're indexing the player not the character and hit isn't a valid event/instance of the character. I reccomend doing debounce so then if lots

0

of players touch the same guy then it will just crash or make the guy lag alot and make his health go below 100. Those are just my reccomendations. with those steps you should be good!

0

thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.