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.
You can use :MoveTo()
to change a player/model position, please remember that your model will need to have a PrimaryPart
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:MoveTo(surfacespowns[math.random(1,#surfacespowns)].CFrame.position) 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
If your still having issues, try using CFrame.
local part1 = game.workspace.BluePart local plr = game.Players:FindFirstChild("LocalPlayer") plr.Character.HumanoidRootPart.CFrame = part1.CFrame * CFrame.new(0, 0, 1)
Read more on CFrames: https://developer.roblox.com/en-us/api-reference/datatype/CFrame