Single BoolValue for 2 local script

how do i change a BoolValue or Value in general Globally with a local script?

You don’t. Any change with a script ran on the client will only affect things on that client.

You would need for your local script to send an event to the server, and the server make a global change.

that can work just fine but the problem is that the bool value will be different to each player based on the actions that they did

From a LocalScript, you can only change a BoolValue for the client, not other clients or the server.

Can you explain what this system is used for? It might help you get better results.

to be more clear there is a Gui that changes its size based on the value number, one script shortens the size and the other one makes the size bigger, its too much to explain why i cant put them both in a single script but i need that value that both scripts read to be the same

If you want 2 scripts on a single client to access a value, then put the value as an Attribute under the player.Character


if its an attribute will all changes made to it in a local script be shown to other local scripts or scripts?

use a RemoteEvent

oh just read this now, I recommend using _G if you need a value to be accessed by other scripts or just the value instance
example of _G

--script 1
_G.SomeNumberValue = 5
while wait () do
part.Size =,_G.SomeNumberValue,1)

--script 2
repeat wait() until _G.SomeNumberValue ~= nil --to make sure the value is loaded

_G.SomeNumberValue = math.random(1,5)

Attributes are still better, considering you can set them and monitor them in studio, under properties, and you can have them fire an event when changed.

Also you can set them to be parented to the Player if you dont want them to reset when the character dies, or if you do want them to reset, you can parent them to the player.Character

1 Like

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