Hi Thank You for your time i have a problem i want every player to move or teleport to different maps but it does not work and sometimes it does glitches here is the code i have different surfaces and every 30 seconds i want to teleport to the another map.
for y,players in pairs(plrs) do
for i,surface in pairs(surfaces) do
local gamecharacter=players.Character or players.CharacterAdded:Wait()
if gamecharacter then
local surfacespowns=surface:FindFirstChild("Spown"):GetChildren()
wait(1)
gamecharacter:FindFirstChild("HumanoidRootPart").CFrame=surfacespowns[math.random(1,#surfacespowns)].CFrame
game:GetService("ReplicatedStorage").Desider.CanCollide=false
wait(30)
else
if not players then
table.remove(plrs,i)
end
end
table.remove(surfaces,i)
end
end
thank you if u have a solution please answer my question.

15 comments
explain your answer on this then: https://scriptinghelpers.org/questions/102007/why-wont-this-image-label-appear
hey thanks but on this line gamecharacter:MoveTo(surfacespowns[math.random(1,#surfacespowns)].Position) it gives me this error attempt to index number with 'Position'
Try it now, I edited the answer
ok
it gave me attempt to index number with 'CFrame'
can you explain me better what surfacespoints is? I need to know to fix the answer [If possible add it on the question]
servicespowns is a list of spwns in that map
spawns you mean the part?
no real spown points
so vector3 positions or CFrame? [If one of thease, please specify]
cframes
how do i know i guess vector3
Add the variable at the question so I can see it, it will be easyer to fix
hi suurfacespown is a model in each surface local surfacespowns=surface:FindFirstChild("Spown"):GetChildren() and then i get a random spownpoint from that model and then try to teleport all players to random spownpoint in the map with is in the spownpoints model ans thank u for trying to solve my problem learmir
hi thank u this line solved everything character:FindFirstChild("HumanoidRootPart").CFrame=allspowns[math.random(1,#allspowns)].CFrame