Why isn't my script working?
Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
So I tried asking on the roblox forum but that didn't help at all. In this script, I'm trying to give every player a gun, give them a string value, and teleport them to the map. When I uploaded my game to roblox, first of all, only one player received the gun, and second of all, no one was teleported. Do you guys see any issues?
01 | local spawns = arenaclone:WaitForChild( "Spawns" ):GetChildren() |
03 | for _, player in pairs (game.Players:GetPlayers()) do |
04 | if player and #spawns > 0 then |
06 | local backpack = player:WaitForChild( "Backpack" ) |
07 | local hyperlaser = replicatedstorage.HyperLaser |
08 | tool = hyperlaser:Clone() |
09 | tool.Parent = backpack |
10 | local matchtag = Instance.new( "StringValue" ) |
11 | matchtag.Name = "MatchTag" |
12 | matchtag.Parent = player.Character |
14 | local torso = player.Character:WaitForChild( "Torso" ) |
15 | local allspawns = math.random( 1 , #spawns) |
16 | local randomspawn = spawns [ allspawns ] |
17 | if randomspawn and torso then |
19 | table.remove(spawns, allspawns) |
20 | torso.CFrame = CFrame.new(randomspawn.Position + Vector 3. new( 0 , 2 , 0 )) |