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

How can I get this working for it to insert a name into a random slot?

I have all players on a team of bright green inserted to 1 random slot of a string value? I have a script and 3 string values in the script named King. How can I make the script below work so that it will insert all the players on green in 1 random slot once??

print("Starting for random slots on green") local labels={} local count=1 for _,v in pairs(game.Players:GetPlayers())do if v.TeamColor==BrickColor.new("Bright green")and labels[count]then labels[count]=v table.insert(labels,count,v.Name) count=count+1 print("Ended random slots on green") end end

1 answer

There isn't a [1] in the table, so it will not do what you wish.

1 comment

0

but if I do that, it says there needs to be a numbervalue. I only want the names printed in a string value

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