Why Is value not changing?

Hi, so I’ve made a code to change a bool value. The code is printing that it has been changed, however the value hasn’t been changed. There are no errors so I’m unsure why this is occuring.

script.Parent.MouseButton1Down:Connect(function()
	if script.Parent.t.Value == true then
		script.Parent.t.Value = false
		print('Corrected')
	else
		print('Nope')
		return nil
	end
end)

(it prints ‘Corrected’)
Anyone know why?

print script.Paren.t.Value when you click

Your code lets it change from true to false, but not from false to true. Is that the intended behaviour?

image

It’s done by another script because I’m looping through a function but I can’t seem to change it whilst in a while loop so I do it in a short simple script

Are you sure there isn’t something else in your game changing it back to true immediately after being changed? Also try replacing print('Corrected') with print(script.Parent.t.Value) and send a screenshot of what prints

You’re changing the value to false in the script. In the output after it is changed, it prints false, meaning that the value is changing. Are you sure this is a real issue?