Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does the value only changes 2 times and then stops working?

Here's the script :

local v =game.Workspace.AV
script.Parent.Touched:Connect(function(part)
	
	   if v.Value ~= 2 then
 v.Value = 1
	     end
end)

The script checks if the value is equal to 2 and then it changes it to 1 when the part is touched.

There's another script that changes the value from 1 to 2.

1 answer

Your script checks whether or not v.Value is not equal to 2. You mentioned that you have another script that changes the value from 1 to 2. Here lies your problem. When the value turns to 2, the condition v.Value ~= 2 becomes false and there will no way to turn the value back to 1 again (assuming that there are no other scripts involved).

1 comment

0

Oh true, and how can I fix it? Add a loop?

This discussion is preserved as it was. New answers, comments, and votes are closed.