How to regenerate terrain after a specific condition has been met?

Hello Devforum,

I’ve been trying to make a terrain regeneration script that regenerates a block of terrain after a game’s round has ended. I have tried using various conditions that are met when a round ends (Enabled, Visible, etc.) on various objects (Blurs, TextLabels) for the script to detect in order to commence the regeneration but to no avail. The script just doesn’t seem to detect that the condition(s) have been met. How can I make this work?

local terrainBlock = script.Parent

local function regenTerrain()
	warn("Intermission started")
	game.Workspace.Terrain:FillBlock(terrainBlock.CFrame, terrainBlock.Size, Enum.Material.Glacier)
	terrainBlock.Transparency = 1
	terrainBlock.CanCollide = false
	terrainBlock.Parent = game.ServerStorage

while true do
	if game.Lighting.Blur.Enabled == true then
		terrainBlock.Parent = game.Workspace

(p.s. i am not a programmer)

Some attachments (3rd image is the “terrainBlock” in question):
Capture d’écran 2024-07-09 à 12.30.12 PM Capture d’écran 2024-07-09 à 12.31.23 PM



Are there any errors in the output? And also, use task.wait() instead of wait().

1 Like

Nope, there isn’t anything from the script in the output at all. Also, where should I put the task.wait()? I tried replacing both wait()s with it and then each one singularly but it still doesn’t work. Additionally, I noticed that if I set the condition to if ... == false it actually works but doesn’t stop. It doesn’t seem to notice when the Blur is on.