If statement does not check changes

oh look it says " We are currently investigating a service disruption :warning: :hammer_and_wrench: status.roblox.com"

but anyways, it does not work. his script didn’t work. I tried it even before you said that.

Can I see the part when viewed in Properties and how the part looks in explorer?

Try a boolvalue, and make sure you’re testing this on the server-side using the server-client switcher.

I don’t see why setting the attribute doesn’t work properly.

it looks game.Workspace.Part

the script is parented under the part

Is the script inside of the part?

1 Like

This thread is really confusing me, so I’ll just try to give you a script that might hopefully work.

1 Like

it is hard, no sending in screenshots!

What, why? I was only trying to help.

1 Like

thanks. But your script did not work.
I also fixed it and didn’t work.
why doesn’t it work?

I am not sure either. Try asking someone else, I’m not familiar with attributes.

1 Like

if you are not familiar with attributes, then why did you even send me a script?

Your problem is that DOT is put outside the loop, which means that the variable can’t be kept updated this way. To make that work, put DOT inside the while loop.
Also, I suggest you to use game:GetService("RunService").Stepped to run your code, since it consumes less server performance.
One last thing: your while loop might also interrupt because you didn’t put any wait() in it. This probably makes your script to be killed in order to prevent major server performance issues.

while true do	
local DOT = Part:GetAttribute("DisappearOnTouch") --Put it here, inside the loop.

if DOT == true then
	script.Parent.Touched:Connect(function()
			script.Parent:Destroy()
		end)
end
wait() --A delay is needed in order to prevent your script to be killed.
end
local Part = script.Parent

local DotAttributeChanged = Part:GetAttributeChangedSignal("Dot")

DotAttributeChanged.Connect(function()
	if Part:GetAttribute("Dot") then
		Part:Destroy()
	end
end)

https://developer.roblox.com/en-us/api-reference/function/Instance/GetAttributeChangedSignal