You can place a NumberValue
in ReplicatedStorage
, which can be accessed by both server scripts and local scripts. If you want it to be accessible only by server scripts, use ServerStorage
instead.
As a demonstration, place a NumberValue
in ReplicatedStorage
as shown:
Create two server scripts, the first named "Primary Script", and the second named "Other Script":
game.ReplicatedStorage.BarierNumber.Value = 123
print("Primary Script:", game.ReplicatedStorage.BarierNumber.Value)
print("Other Script:", game.ReplicatedStorage.BarierNumber.Value)
Then, create a local script called "Local Script":
print("Local Script:", game.ReplicatedStorage.BarierNumber.Value)
Then, run the game and notice that all scripts retrieve the correct value: