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

If state doesn't see that value is changed?

Howdy.

Currently i'm writing a script that runs when a Boolvalue = true

The value is false in the beginning.

But, when i change it to true, the If ... Statement keeps thinking that the value = false, however, i changed it to true?

This is the script with malfunctions.

while true do
Active = script.Parent.Active
Busy = script.Parent.Busy
wait(1)
	print(Active.Value) -- To see if he sees that the value has changed
	if Active.Value == true then
		wait()
		if Busy.Value == false then
			Busy.Value = true
			wait()
			repeat
				wait()
				FadeOnLights()	
				wait(2)
				FadeOffLights()
				wait(2)
			until Active.Value == false
			Busy.Value = false
		end
	end
wait()
end

It's probably a dumb thing to ask. But it's annoying me as hell.

Edit: The

print(Active.Value)

keeps printing it's false, however it has been changed to true. No matter if it's manualy changed or by a script.

4 comments

0

So whats your ultimate goal here?

0

So whats your ultimate goal here?

0

are you changing the values manually in explorer and properties panels or are you using scripts? bcz if your doing it manuaelly in explorer/properties panels then it really just changes to you visually but not the server'

0

Not really the right way to say that, but ya.

1 answer

well, your code there looks quite unreasonably heavy and that's not good b/c it could quite lag your game;

one possible explanation to this is that your changing the values in explorer/properties panels b/c that will only make the value look true but it's really not; so your best shot will be to change it through scripts: if your code is in a LocalScript then the value should be changed with a LocaScript, Otherwise you would have to use RemoteEvents

here is an alternative to what i think your possibly trying to do

Active = script.Parent.Active
Busy = script.Parent.Busy

function stuffWithLights()
	while Active.Value do 
		FadeOnLights()  
                wait(2)
                FadeOffLights()
                wait(2)
	end
end


Active.Changed:Connect(function()
	if Active.Value and not Busy.Value then
		Busy.Value = not Busy.Value
	else
		Busy.Value = false
	end
end

1 comment

0

It was an early stage lol. Finishtouch had to come yet

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