Hello, is it possible to somehow sync a numeric leaderboard value with a workspace’s value? As I’m very concerned about that since I could have to cancel one of my 18 projects due that or try something else. If anyone knows if it’s possible… It’ll be valuable to tell.
(P.S: Sorry for any possible grammar failure. I’m Spanish not English)
Version Española:
Hola, es posible de alguna manera sincronizar un valor numerico de la tabla de clasificacion con un valor del workspace? Estoy muy preocupado desde que podria ser que tuviera que cancelar uno de mis 18 proyectos por eso o intentar otra cosa. Si alguien sabe si es posible… Sera valuable decirlo.
(P.S: Perdon por algun fallo de ortografia. Soy Español, no Anglosajon)
Hey dani31c,
could you clarify what you mean by workspace's value??
In addition, @UnderMyWheel’s solution works perfectly, however it would be best practice to use :GetPropertyChangedSignal() which would be optimal
In this case, the GetPropertyChangedSignal does not need to be used at all as Value instances have a non-inherited Changed event that will only fire when the Value property changes.
This means there are absolutely no benefits to using GetPropertyChangedSignal and using the Changed event is the best practice.
I think I know how to use UnderMyWheel’s solution and I think it works.
while true do
local WMoney = game.workspace.Money.Value
local SMoney = gameServerStorage.Money.Value
Wmoney.Changed:Connect(function(WMoney)
SMoney = WMoney --- This is to adapt it shall work.
wait (0.1)
It is a loop meaning it is going to attempt to create a Changed event every tenth of a second
The Changed event is part of numerical value instance, but you are currently indexing the Value property of the numerical value and then attempting to use the Changed event
Your code should look like:
local WMoney = workspace.Money
local SMoney = game:GetService('ServerStorage').Money
WMoney.Changed:Connect(function(newWMoneyCount)
SMoney.Value = newWMoneyCount
end)
Then, how about looping it and making instead to every likelly… 0.1 seconds it to update the value? Would that work? I mean, Smoney = WMoney
While true do
local WMoney = game.workspace.Money.Value
local Smoney = game.ServerStorage.Money.Value
Smoney = Wmoney --- Updates the value to current.
wait(0.1)
Personally, I find it cleaner to use the code example I have provided you with. In addition, running a loop to update the values every .1 is inefficient.