#Help

1 messages · Page 1 of 1 (latest)

left crane
#

Guys suppose i have a script in serverscriptstorage that creates a leaderstat (and of course a value). Is there a way to refer to this value but in another script?

glad skiffBOT
#

studio** You are now Level 4! **studio

wet sierra
#

i think you already know how to do that in a serverscript then after that

left crane
#

Yes

#

Ok next?

wet sierra
# left crane Ok next?

your gonna have to do

-- pretend theres some functions here

local leaderstats = player:FindFirstChild("leaderstats")
#

and thats literally it

left crane
#

Yes ik how to do that

#

But what is next

warm jewel
#

you then index it with something to get the desired value instance 🤷‍♂️

wet sierra
#

i like using FindFirstChild but you can just use

leaderstats.ValueName.Value
left crane
#

Oh so if I have a " silverCoin" value, i can type in another script "leaderstats.silverCoin.Value?

warm jewel
#

yes, just make sure that you read/write it in the right runcontext to make sure it replicates as expected

#

Basically, rule of thumb is:
server: read/write
client: read

left crane
#

Ok

#

I'll try this