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

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

Asked by 10 years ago

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

Log in to vote
-2
Answered by 10 years ago

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

0
but if I do that, it says there needs to be a numbervalue. I only want the names printed in a string value billybobtijoseph 1 — 10y
Ad

Answer this question