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

How do I run through the list of players and set individual variables ?

How do I run through all the players in a server, and set 16 groups of variables with Players Names and User Ids without any repeating! I ask this because I will have a brick in the game with a SurfaceGui and this will make all the information easier to access.

Here's what I have for the beginning of my function.

function HGSpawn() for i = 1,#AllPlayers do if AllPlayers[i]:WaitForChild("Settings"):WaitForChild("HG").Value == false then AllPlayers[i]:WaitForChild("Settings"):WaitForChild("HG").Value = true if HGS.HG1.Toggle.Value == false then HGS.HG1.Toggle.Value = true HGS.HG1.Avatar.Value = AllPlayers[i].UserId HGS.HG1.Player.Value = AllPlayers[i].Name elseif HGS.HG1.Toggle.Value == true then HGS.HG2.Toggle.Value = true HGS.HG2.Avatar.Value = AllPlayers[i].UserId HGS.HG2.Player.Value = AllPlayers[i].Name

1 comment

0

 Use codeblocks which are ~ so we can read your script, sigh

1 answer

Sorry, I'm new to scripting helpers... still trying to figure it out.

Heres the bad coding I did


function HGSpawn() for i = 1,#AllPlayers do if AllPlayers[i]:WaitForChild("Settings"):WaitForChild("HG").Value == false then AllPlayers[i]:WaitForChild("Settings"):WaitForChild("HG").Value = true if HGS.HG1.Toggle.Value == false then HGS.HG1.Toggle.Value = true HGS.HG1.Avatar.Value = AllPlayers[i].UserId HGS.HG1.Player.Value = AllPlayers[i].Name elseif HGS.HG1.Toggle.Value == true then HGS.HG2.Toggle.Value = true HGS.HG2.Avatar.Value = AllPlayers[i].UserId HGS.HG2.Player.Value = AllPlayers[i].Name


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