Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to kill a player if touched by another player?

Asked by 3 years ago

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

0
uhh do you have any attempts?? kepiblop 124 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)

0
apart from this i dont know what to do Zythicaal 2 — 3y
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 kepiblop 124 — 3y
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! kepiblop 124 — 3y
0
thank you! Zythicaal 2 — 3y
Ad

Answer this question