I noticed that when you insert values into workspace and change them in a ServerScriptService they will replicate to all clients. I’m trying to make the server only know the value and I don’t want my values to replicate to clients.
For example:
local Value = workspace:WaitForChild("NumberValue")
task.wait(5)
-- Change the value
-- This is done on a serverscript so it replicates to all clients all I want it is to not replicate to any clients at all.
Value.Value = 100
Just curious, how is using _G different from simply storing the value in ServerStorage? Both are placed somewhere away from your model
AFAIH both _G and shared should not be used because of possible race-conditions where one script loads before another, causing the value to potebtially not be set yet
I suppose if you want that value to be linked under the model, you could place a NumberValue or StringValue or whatever in ServerStorage, then place an ObjectValue in the Model with its Value set to the NumberValue so that it can be accessed from other server scripts.
_G is still a perfectly valid approach though I do recommend you use protection against race-conditions. I.e.
-- Script 1
_G.MySecretValues = {}
....
-- Script 2
repeat task.wait() until _G.MySecretValues
_G.MySecretValues.ABC = 123
(BTW do not unmark blueberry’s answer as solution, not that I think you would.)