the script doesn’t work. The player is supposed to teleport to the map, but this does not happen. No error, the script just doesn’t work
local lobby = game.Workspace.Spawn
local map = game.ReplicatedStorage.Maps:GetChildren()
local status = game.ReplicatedStorage.Status
while true do
for i = 5, 0, -1 do
status.Value = "Intermission:"..i
wait(1)
end
local chosenmap = map[math.random(1, #map)]
local clonemap = chosenmap:Clone()
clonemap.Parent = game.Workspace
status.Value = "Map:"..clonemap.Name
wait(2.5)
local chosenplayer1 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
local chosenplayer2 = nil
repeat
chosenplayer2 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
wait()
until
chosenplayer2.Name ~= chosenplayer1.Name
chosenplayer1.Character.CFrame = clonemap.Teleport1.CFrame
chosenplayer2.Character.CFrame = clonemap.Teleport2.CFrame
for i = 10, 0, -1 do
status.Value = "Liquidation:"..i
wait(1)
end
local chosenplayer1 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
local chosenplayer2 = nil
repeat
chosenplayer2 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
wait()
until
chosenplayer2.Name ~= chosenplayer1.Name
chosenplayer1.Character.CFrame = clonemap.Teleport1.CFrame
chosenplayer2.Character.CFrame = clonemap.Teleport2.CFrame
clonemap:Destroy()
end
Why are you destroying the map after you teleport them to it?
When does the code stop working?
When teleporting the players, you should use-
chosenplayer1.Character:PivotTo(clonemap.Teleport1.CFrame)
chosenplayer2.Character:PivotTo(clonemap.Teleport2.CFrame)
local lobby = game.Workspace.Spawn
local map = game.ReplicatedStorage.Maps:GetChildren()
local status = game.ReplicatedStorage.Status
while true do
for i = 5, 0, -1 do
status.Value = "Intermission:"..i
wait(1)
end
local chosenmap = map[math.random(1, #map)]
local clonemap = chosenmap:Clone()
clonemap.Parent = game.Workspace
status.Value = "Map:"..clonemap.Name
wait(2.5)
local chosenplayer1 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
local chosenplayer2 = nil
repeat
chosenplayer2 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
wait()
until
chosenplayer2.Name ~= chosenplayer1.Name
chosenplayer1.Character.CFrame = clonemap.Teleport1.CFrame
chosenplayer2.Character.CFrame = clonemap.Teleport2.CFrame
for i = 10, 0, -1 do
status.Value = "Liquidation:"..i
wait(1)
end
local chosenplayer1 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
local chosenplayer2 = nil
repeat
chosenplayer2 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
wait()
until
chosenplayer2.Name ~= chosenplayer1.Name
chosenplayer1.Character:MoveTo(clonemap.Teleport1.Position)
chosenplayer2.Character:MoveTo(clonemap.Teleport2.Position)
clonemap:Destroy()
end
also this is what i would do if i were writing it:
local lobby = game.Workspace.Spawn
local map = game.ReplicatedStorage.Maps:GetChildren()
local status = game.ReplicatedStorage.Status
while true do
for i = 5, 0, -1 do
status.Value = "Intermission:"..i
wait(1)
end
local chosenmap = map[math.random(1, #map)]
local clonemap = chosenmap:Clone()
clonemap.Parent = game.Workspace
status.Value = "Map:"..clonemap.Name
wait(2.5)
local chosenplayer1 = game.Players:GetPlayers()[math.random(1,#game.Players:GetPlayers())]
local chosenplayer2 = nil
repeat
wait()
chosenplayer2 = game.Players:GetPlayers(math.random(1, #game.Players:GetPlayers()))
until chosenplayer2 ~= chosenplayer1
chosenplayer1.Character:PivotTo(clonemap.Teleport1.CFrame)
chosenplayer2.Character:PivotTo(clonemap.Teleport2.CFrame)
for i = 10, 0, -1 do
status.Value = "Liquidation:"..i
wait(1)
end
clonemap:Destroy()
end