helllo. i have left rooms, right rooms and straight rooms. the problem is that they often collide like this.
my script looks like this…
function Create_Room()
if #script.ENEMY_FOLDER.Value:GetChildren() == 0 then
if db then db = false
if script.ROOM_AMOUNT.Value == math.floor(script.MAX_ROOMS.Value/2 + 0.5) and script.CAN_CREATE_LIBARY.Value == true then
script.CAN_CREATE_LIBARY.Value = false
Seek_Eyes()
task.wait()
LIBARY()
elseif script.ROOM_AMOUNT.Value < script.MAX_ROOMS.Value then
local SELECTED_FOLDER = false
if script.ROOM_AMOUNT.Value > math.floor(script.MAX_ROOMS.Value/2 + 0.5) then
SELECTED_FOLDER = script.Rooms_Folder.Value.GREENHOUSE_ROOMS
elseif script.ROOM_AMOUNT.Value < math.floor(script.MAX_ROOMS.Value/2 + 0.5) then
SELECTED_FOLDER = script.Rooms_Folder.Value.NORMAL
end
task.wait(0.2)
script.ROOM_AMOUNT.Value = script.ROOM_AMOUNT.Value + 1
local Rooms = SELECTED_FOLDER:GetChildren()
local Room = Rooms[math.random(1, #Rooms)]
if Room ~= nil then
warn(Room.Name)
local New_Room = Room:Clone()
New_Room.Parent = script.ACTIVE_ROOMS_FOLDER.Value
New_Room.Name = script.ROOM_AMOUNT.Value
script.Trigger.Value = New_Room:FindFirstChild("END")
task.wait()
New_Room:PivotTo(script.Current_Room.Value:WaitForChild("END").CFrame)
task.wait()
script.Current_Room.Value = New_Room
AddFurniture()
warn("created room")
if script.ROOM_AMOUNT.Value > 3 then
local Chance = math.random(1,6)
warn(Chance)
if Chance == 1 then
--Rush()
elseif Chance == 2 then
--Ambush()
script.SOUNDS.Dark_Room:Play()
else
end
end
end
script.Cleaning.CYCLE.Value = script.Cleaning.CYCLE.Value + 1
if script.Cleaning.CYCLE.Value == script.Cleaning.MAX_CYCLE.Value then
Clear_Old_Rooms()
script.Cleaning.CYCLE.Value = 0
end
elseif script.ROOM_AMOUNT.Value == script.MAX_ROOMS.Value and script.CAN_CREATE_END.Value == true then
MakeLastRoom()
task.wait()
db = true
elseif script.CAN_CREATE_END.Value == false then
script.SPAWN_ROOM.Value:FindFirstChild("END").CanTouch = false
task.wait()
Create_Room()
script.SPAWN_ROOM.Value:FindFirstChild("END").CanTouch = true
db = true
end
end
task.wait(0.2)
db = true
end
end
i would highly appreciate if someone could implement a detection for when already left or right room sapwned to evoid colision