Lol, confusing name I know.
So, me and iv in pairs aren't good friends, and I'm just learning to script, but I require some assistance. Basically, im making a round based game, and i dont know how to get it to move all players randomly to bricks names SP-1, SP-2, and so on to SP-10, when I set a value in workspace to true. Would anyone mind helping me out?
I'm going to explain something about i,v.
a "iv" for loop, loops though all things given in in pairs(-here-)
i,v can be any value. Mostly we don't use the i value, so we put in for _,v in
but that doesn't make a difference either. (Just for decorations)
If we say for i,v in pairs(game.Workspace:GetChildren()) do
it would loop through each child of the workspace.
i is the number of loops that have passed.
v is the instance that is currently picked out of the pairs(-here-)
For players, this would be pairs(game.Players:GetPlayers())
Now for the script.
As this isn't a request site im going to leave a few blanks for you to fill in.
I'd suppose all these "SP-#" parts are in all in a model.
local players = game.Players local spawnParts = --fill game.Workspace.Value.Changed:Connect(function() -- you said fire on workspace value changed. if game.Workspace.Value.Value == true then for i,v in pairs(--[[fill]]) do -- Loop through all players if v.Character then if v.Character:FindFirstChild("Torso") then v.Character.Torso.CFrame = spawnParts["SP-"..math.random(1,10)] -- Set the torso's cframe to spParts.SP-(1 to 10) end end end end end)
Any questions? Put down a comment :)