Hi, I'm making a minigame which is a race to the finish, but due to how I scripted the game it can pick only one winner; the last one standing alive, so I tried multiple ways to make a script that once inserted in a part, will kill all other players except the one which touched it. Can anyone give me a hand? Thanks in advance!
game.Workspace.Part.KillEverybodyWhoDidntTouchItAfterTheFirstGuyTouchesIt()
like vulkarin said find name of the person that touches it (winner or exploiter) with something like
game.Workspace.WinPart.Touched:connect(function(hit) local Winner = hit.Parent.Name -- if not hit.parent then just hit
then go through the playerlist with for loop (im not to good in for loops just yet cut me some slack)
Players = game:GetService("Players") for i, player in pairs(Players:GetPlayers()) do if player.Name = not Winner then player.Character.Humanoid.Health = 0 --or breakjoints end
script.Parent.Touched:connect(function(hit) hit.parent.Head:Destroy() end)
Hope this helped :D