Why this script runs only once

nothing, even not prints prompt triggered

Maybe because something else in the script is yielding the script?

Could be possible, is that the full script?

Uhhh literally no? This is full script, and no other script works with this script

And also if i removing debounce this don’t give any result

add a print after Deb = false and test if it prints

Already done this… I’m testing this

And does it print? Maybe it’s just the wait()s yielding the script

Try also making a new thread every time the porximity prompt is triggered with
task.spawn(function()

I was going to suggest that too, but we need to make sure if the function even ends at all

image

uhhhh, have no idea how task.spawn works, can you explain?

Try switching it around. Make it false after the if statement and then true at the end.

Done this already before (30 letterssssssssssssssssss)
EDIT: this is not connected with topic, but i already hate my ideas for special tycoon floor xD

Try this. iirc this shouldn’t yield the script

 local Prompt = script.Parent
local Region = script.Parent.Parent.Parent.Parent.Region
local CloseThing = script.Parent.Parent.Parent.Parent.CloseThing
local TweenService = game:GetService("TweenService")
local Time = 5
local Deb = false

local function isInsideBrick(position, brick)
	local v3 = brick.CFrame:PointToObjectSpace(position)
	return (math.abs(v3.X) <= brick.Size.X / 2)
		and (math.abs(v3.Y) <= brick.Size.Y / 2)
		and (math.abs(v3.Z) <= brick.Size.Z / 2)
end

local function onPromptTriggered(Plr)
	print("Prompt triggered and Deb = "..Deb)
	if Deb then return end
	Deb = true
	local Torso = Plr.Character.PrimaryPart
	print("Found torso, deb is true, torso inside brick")
	if Torso and isInsideBrick(Torso.Position, Region) then
		Torso.Anchored = true
		local MoveUp = TweenService:Create(Torso, TweenInfo.new(Time, Enum.EasingStyle.Quad), {Position =  CloseThing.Position + Vector3.new(0,7,0)})
		print("Tween Created")
		MoveUp:Play(); MoveUp.Completed:Wait()
		print("Tween finished playing")
		Torso.Anchored = false
		CloseThing.Transparency = 0
		CloseThing.CanCollide = true
		task.wait(Time)
		print("Task has been successfully executed.")
		CloseThing.Transparency = 1
		CloseThing.CanCollide = false
	end
	Deb = false
end

Prompt.Triggered:Connect(onPromptTriggered)

If this doesn’t work, try replacing the last line (Prompt.Triggered:Connect(onPromptTriggered))
with this:
Prompt.Triggered:Connect(function(Plr) task.spawn(onPromptTriggered(Plr)) end)

try replacing print("Prompt triggered and Deb = "..Deb)
with print("Prompt triggered and Deb = "..tostring(Deb))
That should fix it, I don’t know why the error didn’t appear earlier though…

I just removed deb from print this gave same result, lemme try
Prompt.Triggered:Connect(function(Plr) task.spawn(onPromptTriggered(Plr)) end)

Look at your proximity prompt properties, it may be set to “OncePerPlayer”