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

How To Make It Last Man Standing?

Asked by 3 years ago

I have been trying to make this script teleport players one when player is remaining. I know how to make it so that it teleports you when one player is remaining, but, how do I reference the player if it is in a Model.

01t=200 -- Focus On This Part To The Next Bookmark
02    repeat
03        t = t-1
04        s.Value = t.." Seconds Left"
05        wait (1)
06        local ingame = workspace.Ingame:GetChildren()
07    until t ==0 or #ingame == 0 or #ingame == 1 -- This means that 1 player is remaining, but I want to make to make it so that it displays the name on a text label. Since the charactor is a model with the name of the play I want to reference it but do not know how.
08 
09    if vals.Winner.Value ~= "" then
10        s.Value = vals.Winner.Value.. " Has Won!" -- Focus till this part
11 
12game.Players[vals.Winner.Value].leaderstats.Points.Value =game.Players[vals.Winner.Value].leaderstats.Points.Value +5
13game.Players[vals.Winner.Value].leaderstats.Wins.Value = game.Players[vals.Winner.Value].leaderstats.Wins.Value +1
14 
15        vals.Winner.Value = ""
View all 25 lines...

1 answer

Log in to vote
1
Answered by 3 years ago

You already are getting a player from a character on this line:

1local plr = game.Players:GetPlayerFromCharacter(ingame[i])

You can use the same method, Players:GetPlayerFromCharacter(), and pass in the character model as a parameter.

Ad

Answer this question