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

Help With An IPairs Script?

while true do
ToMap = CFrame.new(-2, 20.5, -50)
ToSpawn = CFrame.new(277.5, 1.5, -206.5)
wait(10)
for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do
	m1.Transparency = 1
	m1.CanCollid = false
for i, player in ipairs(game.Players:GetChildren()) do
   if player.Character and player.Character:FindFirstChild("Torso") then
      player.Character.Torso.CFrame = ToMap + Vector3.new(0, i * 5, 0)
	  player.TeamColor = game.Teams["Playing"].TeamColor
	  m1.Transparency = 0
	  m1.CanCollide = true
	  wait(10)
	  m1.Transparency = 1
	  m1.CanCollide = false
	  player.TeamColor = game.Teams["Lobby"].TeamColor
	  player.Character.Torso.CFrame = ToSpawn + Vector3.new(0, i * 5, 0)
	end
	end
   end
end

This script all works except for the m1, which the the map that I want to load in. The players get teleported in and out and their teams change accordingly, but the map won't load and unload. Can someone help me adjust this to fix it?

2 comments

0

Is there any error in the output? Have you done any debugging?

0

Nope, I'm getting any output errors, and I don't know how to do 'debugging' besides looking at the output

1 answer

✓ Accepted answer

1: You are setting it invisible when you load it

2: (I am not sure if this is on purpose) You are making it invisible then visible then invisible for every player every 10 seconds.

(3: You are making it visible twice)

Fixed:

while true do
ToMap = CFrame.new(-2, 20.5, -50)
ToSpawn = CFrame.new(277.5, 1.5, -206.5)
wait(10)
for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do
    m1.Transparency = 0
    m1.CanCollide = true
end
for i, player in ipairs(game.Players:GetChildren()) do
   if player.Character and player.Character:FindFirstChild("Torso") then
      player.Character.Torso.CFrame = ToMap + Vector3.new(0, i * 5, 0)
      player.TeamColor = game.Teams["Playing"].TeamColor
    end    
end
wait(10)
for i, m1 in ipairs(game.Workspace.MapOne:GetChildren()) do
    m1.Transparency = 1 
    m1.CanCollide = false
end
for i, player in ipairs(game.Players:GetChildren()) do
      if player.Character and player.Character:FindFirstChild("Torso") then
           player.TeamColor = game.Teams["Lobby"].TeamColor
           player.Character.Torso.CFrame = ToSpawn + Vector3.new(0, i * 5, 0)
     end
end

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