The script doesn't print the correct value

Hello! I’ve made a very simple script that prints if a value is true or false, so if I change the value it should print if it’s true or false

In the video above you can see that it keeps printing “The value is false” even if I change it to true.

script:

while wait(1) do
	if MoveValue.Value == true then
		print("The value is true")
	else
		print("The value is false")
	end
end

Thanks in advance! :grin:

3 Likes

change the value from the server not the client.

click the “test” tab and select server.

2 Likes

Maybe because the game runs while you are changing the boolean.
Try to write a scipt that changes the value after “wait” command after clicking run.
Then apply main script.

1 Like

Yeah, from server not client, but as I wrote below it should work too.

You are testing while client-sided

Server replicates to clients
But client doesnt replicate to server
meaning any change to the server called by the client only changes for the client

If a server makes a change, all clients experience it

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.