- What do you want to achieve? Keep it simple and clear!
I’m following this simple room generation guide:
https://www.youtube.com/watch?v=z0g5sLZapqI
- What is the issue? Include screenshots / videos if possible!
The generation works smoothly with the yellow room, until it tries generating the red room in the video shown below.
For some reason, it generates the OPPOSITE way. This might be with the pivoting. Im really confused to why it’s reversing.
Everything else works well, until it tries generating the red room.
Another important thing worth telling:
When I move the PrimaryPart of the red room (its entrance which is the part sticking out) to the exit of the previous room, its reversed. But for the yellow room, it works fine.
Video:
robloxapp-20250105-1719425.wmv (645.6 KB)
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Module Script:
local room = {}
local possibleRooms = game.ReplicatedStorage.Rooms:GetChildren()
room.Generate = function(prevRoom)
local pickedRoom = possibleRooms[math.random(1,#possibleRooms)] -- Pick a room model.
local NewRoom = pickedRoom:Clone()
NewRoom.PrimaryPart = NewRoom.Entrance -- Set it's primary part.
NewRoom:PivotTo(prevRoom.Exit.CFrame) -- Move to the previous room's exit cframe.
print("Moved")
NewRoom.Parent = workspace.GeneratedRooms --S.E
return NewRoom -- return it so we can use it as a var for prevRoom
end
return room
Server:
local GenerateRoomModule = require(game.ReplicatedStorage.GenerateRoomModule)
local prevRoom = workspace.StartRoom
local x = 1
repeat
x += 1
prevRoom = GenerateRoomModule.Generate(prevRoom)
task.wait(1)
until x == 10