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

Help With An IPairs Script?

Asked by
Scootakip 299 Moderation Voter
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
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?

0
Is there any error in the output? Have you done any debugging? BlueTaslem 18071 — 9y
0
Nope, I'm getting any output errors, and I don't know how to do 'debugging' besides looking at the output Scootakip 299 — 9y

1 answer

Log in to vote
0
Answered by
xAtom_ik 574 Moderation Voter
9 years ago

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
Ad

Answer this question