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

I need help to modify this simple script, how i do that?

Asked by
Gigaset39 111
3 years ago
Edited 3 years ago

This script works,its just that i want that all the players still alive to be writen on the Gui

How i modify this script so when the ”timer”( i ) = to 0 all players that are still on the map(Not in the lobby) are written on the Status.Value? (which is a GUI)

Status.Value its a Gui

i are sec, its a working timer

reward =1

#plrs    its a list of players that are in the table

 Status.Value = "There are "..i.." seconds remaining, and "..#plrs.." players left"

    if i == 0 then
        -- timers goes to 0
        Status.Value = "The winner is "..plrs[1].Name
        plrs[1].leaderstats.Bucks.Value = plrs[1].leaderstats.Bucks.Value + reward
        break
    elseif #plrs == 0 then
        Status.Value = "Nobody won!"
        break
    end
0
Why did you accept and then unaccept? sne_123456 439 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Well You can use a for loop to get to each player in the table.

for i = 1,#plrs do
  local plrnum = plr[i]
  local plrname = plrnum.Name
  print(plrname)
end

The for loop runs through every single player in the table of players and gets out their name!

To see if players are still inside the map you can use the datatype region3 for that. You can use FindPartsInRegion3 and see if there is a humanoid. Find out the humanoid's parent and you have found a player on the map area.

To understand how to use Region3 and its functions red this article which is very well explained!

https://scriptinghelpers.org/questions/35877/quick-explanation-on-region3

Ad

Answer this question