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

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

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

1 comment

0

Why did you accept and then unaccept?

1 answer

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

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