the map appears and later disappears only once. Then an error appears. Please help me fix it!
local intermission = 5
local roundlength = 10
local inround = game.ReplicatedStorage.Inround
local status = game.ReplicatedStorage.Status
local maps = game.ReplicatedStorage.Maps:GetChildren()
local chosenmap = maps[math.random(1, #maps)]
local clonemap = chosenmap:Clone()
inround.Changed:Connect(function()
if inround.Value == true then
for i, v in pairs(game.Players:GetPlayers()) do
local character = v.Character
local humanoidrootpart = character:WaitForChild(“HumanoidRootPart”)
clonemap.Parent = game.Workspace
humanoidrootpart.CFrame = clonemap.Teleport1.CFrame
humanoidrootpart.CFrame = clonemap.Teleport2.CFrame
end
else
for i, v in pairs(game.Players:GetPlayers()) do
local character = v.Character
local humanoidrootpart = character:WaitForChild(“HumanoidRootPart”)
local lobby = game.Workspace.Spawn
humanoidrootpart.CFrame = lobby.Tp1.CFrame
humanoidrootpart.CFrame = lobby.Tp2.CFrame
end
clonemap:Destroy()
end
end)
local function round()
while true do
inround.Value = false
for i = intermission, 0 , -1 do
status.Value = “Intermission:”…i
wait(1)
end
inround.Value = true
for i = roundlength, 0, -1 do
status.Value = “Liquidation:”…i
wait(1)
end
end
end
spawn(round)
the problem was half solved. on the one hand, the problem has stopped being displayed. But now I don’t get into the playing field at all. I’ll send the video. I don’t know if it will help you
One thing I can think of is the part falling into the void because it has CanCollide set to false and Anchored set to true.
Other possibility is that it is getting destroyed by another script.
Sorry, I made a mistake. :Remove() removes all the descendants of the part as well.
local intermission = 5
local roundlength = 10
local inround = game.ReplicatedStorage.Inround
local status = game.ReplicatedStorage.Status
local maps = game.ReplicatedStorage.Maps:GetChildren()
local chosenmap = maps[math.random(1, #maps)]
local clonemap
inround.Changed:Connect(function()
if inround.Value == true then
clonemap = chosenmap:Clone()
for i, v in pairs(game.Players:GetPlayers()) do
local character = v.Character
local humanoidrootpart = character:WaitForChild(“HumanoidRootPart”)
clonemap.Parent = game.Workspace
humanoidrootpart.CFrame = clonemap.Teleport1.CFrame
humanoidrootpart.CFrame = clonemap.Teleport2.CFrame
end
else
for i, v in pairs(game.Players:GetPlayers()) do
local character = v.Character
local humanoidrootpart = character:WaitForChild(“HumanoidRootPart”)
local lobby = game.Workspace.Spawn
humanoidrootpart.CFrame = lobby.Tp1.CFrame
humanoidrootpart.CFrame = lobby.Tp2.CFrame
end
clonemap:Destroy()
end
end)
local function round()
while true do
inround.Value = false
for i = intermission, 0 , -1 do
status.Value = “Intermission:”…i
wait(1)
end
inround.Value = true
for i = roundlength, 0, -1 do
status.Value = “Liquidation:”…i
wait(1)
end
end
end
spawn(round)
thank you very much. everything works fine except that I now have only one map out of two. either I was unlucky that I had only the “Rafts” map out of 10 rounds, or something was wrong in the script