Rooms Entity Breaking

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    A rooms fangame entity (for my unique fangame)

  2. What is the issue? Include screenshots / videos if possible!
    The second time it spawns, it won’t despawn.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    its unique. -_-

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!

local delay = false

local function GenerateRoom()
	local NewRoom = workspace.PremadeRooms:GetChildren()[math.random(1, #workspace.PremadeRooms:GetChildren())]:Clone()
	NewRoom.Parent = workspace.GeneratedRooms
	NewRoom:SetPrimaryPartCFrame(workspace.CurrentRoom.Value.Exit.CFrame)
	workspace.CurrentRoom.Value = NewRoom
	local Door = game.ServerStorage.Door:Clone()
	Door.Parent = workspace.GeneratedDoors
	Door:SetPrimaryPartCFrame(workspace.CurrentRoom.Value.Exit.CFrame)
	workspace.CurrentDoor.Value = Door
end

local function A5(Door)
	local A5a = game.ServerStorage["A-5"]:Clone()
	A5a.Parent = workspace.GeneratedEntities
	A5a.Position = Door.Position - Vector3.new(0, 0, 1000)
	A5a.Ambience:Play()
	local A5tween = game.TweenService:Create(A5a, TweenInfo.new(10, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0), {["Position"] = Door.Position})
	A5tween:Play()
	wait(10)
	A5a:Destroy()
	GenerateRoom()
	Door.DragDetector:Destroy()
	Door.Anchored = false
	Door.Velocity = Vector3.new(0, 0, 165)
	Door.DoorBreak1:Play()
	Door.DoorBreak2:Play()
end

local previousdragframe = CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 0, 0))
local currentdragframe = CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 0, 0))
game["Run Service"].Heartbeat:Connect(function()
	currentdragframe = previousdragframe.Position - script.Parent.DragFrame.Position
	if previousdragframe ~= script.Parent.DragFrame.Position and delay == false then
		if currentdragframe.Magnitude >= 2 then
			workspace.RoomID.Value += 1
			if workspace.RoomID.Value == 1 then
				workspace.Ambience:Play()
			end
				delay = true
				GenerateRoom()
				--print("UEAAAAY!Y")
				script.Parent.Parent.Door1:Play()
				script.Parent.Parent.Door2:Play()
				local ScriptParentParentParentTween = game.TweenService:Create(script.Parent.Parent, TweenInfo.new(0.5, Enum.EasingStyle.Circular, Enum.EasingDirection.InOut, 0, false, 0), {["CFrame"] = script.Parent.Parent.Parent.Opened.CFrame})
				ScriptParentParentParentTween:Play()
				wait(1)
			A5(workspace.CurrentDoor.Value.Door)
		end
	end
	
	previousdragframe = script.Parent.DragFrame
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Just a question, can you give me a video example?

ok, i will try to get one on screen. but it will be low quality.

1 Like

No problem, i just want to see it.

robloxapp-20240401-1806509.wmv (2.2 MB)
see how it gets stuck

Wait, i’m downloading the video just wait

hmmm, i see, for some reason it got stuck…

1 Like

yeah, i cannot find the source.

1 Like

Check if there’s any errors in the output and say it if there it is one

there are none.
18:06:51.196 Video recording started - Studio
18:07:14.775 Video recording stopped - Studio
18:07:18.432 Disconnect from ::ffff:127.0.0.1|52361 - Studio
18:10:16.204 Redirected Rooms auto-recovery file was created - Studio

hmm, weird, then why it’s not working?? hmmm, try tweening the entity down idk

i have tried alot. i am not a great coder… (i scripted everything on my own)

1 Like

idk then bro, i’m also not a very good scripter

1 Like

turns out i just needed to lock the door when he spawned. it was the room generation.

2 Likes

oh, lol, i’m glad you fixed it

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.