local ReplicaredStorage = game:GetService("ReplicatedStorage")
local RoomsFolder = ReplicaredStorage:WaitForChild("Rooms")
local Rooms = RoomsFolder:GetChildren()
local MaxRooms = 50
local RoomsLoaded = 0
--Loading all rooms
repeat wait(0.2)
local SelectedRoom = Rooms[math.random(1, #Rooms)]
local ClonedSelectedRoom = SelectedRoom:Clone()
RoomsLoaded = RoomsLoaded + 1
ClonedSelectedRoom.Parent = game.Workspace
ClonedSelectedRoom.Name = "Room"..RoomsLoaded
local PreviousPart = game.Workspace:FindFirstChild("Room"..RoomsLoaded - 1)
local MAIN = PreviousPart:FindFirstChild("MAIN")
local TELEPORT = PreviousPart:FindFirstChild("TELEPORT")
local NewPos = Vector3.new(MAIN.Size.X, 0, 0) + TELEPORT.Position
ClonedSelectedRoom:MoveTo(NewPos)
until RoomsLoaded == MaxRooms
--Loading the end room
local SelectedRoom = ReplicaredStorage:WaitForChild("RoomEnd")
local ClonedSelectedRoom = SelectedRoom:Clone()
ClonedSelectedRoom.Parent = game.Workspace
ClonedSelectedRoom.Name = "RoomEnd"
local PreviousPart = game.Workspace:FindFirstChild("Room"..MaxRooms)
local MAIN = PreviousPart:FindFirstChild("MAIN")
local TELEPORT = PreviousPart:FindFirstChild("TELEPORT")
local NewPos = Vector3.new(MAIN.Size.X, 0, 0) + TELEPORT.Position
ClonedSelectedRoom:MoveTo(NewPos)
There's no error ofc, Some rooms are delayed of 1.5 studs in the Y axis for no reason, NewPos is supposed to be always the same, the "TELEPORT" parts are all the same size are perfectly centered but it still can be a problem with that (TELEPORT parts are like the end of the room and MAIN parts are the start of the room and also the primary part of that room. (because the room is a model.)), please help, thanks.
