#How to reference leaderstats in another script?

38 messages · Page 1 of 1 (latest)

molten kernel
#

Leaderstats is in game.Players.(playernameidk).leaderstats

#

If i try wait for child it just says attempt to index nil w :waitforchild

hexed basin
#

In a local script?

#

@molten kernel

molten kernel
# hexed basin In a local script?

no it’s inside of a click detector, which is inside a part that was spawned in using :clone, i’ll send a pic one sec

#

regular script

hexed basin
#

Ok

molten kernel
thorny garden
#

game.Players.LocalPlayer:WaitForChild("leader")

hexed basin
molten kernel
#

but i cant use

#

yeah

hexed basin
#

Show me the script for click detector

molten kernel
#

should i just use a local script?

#

ok

thorny garden
#

click detector has as player parameter

hexed basin
#

Or change on the server

molten kernel
#

all i have, i’ve tried using :waitforchild(“leaderstats”):waitforchild(“points”).Value

#

but it did not work, same error

hexed basin
#

Ok

#

Inside function()

#

Type player

molten kernel
#

alright

hexed basin
molten kernel
#

it printed my name correctly

hexed basin
#

Ok

#

Now

#

Just local leaderstats = player:WaitForChild(“leaderstats”)

#

local Points = leaderstats:WaitForChild(“Points”)

#

print(Points.Value)

#

Should work

molten kernel
#

finally

#

@hexed basin thank you sm, kinda dumb question but saved me a lot of time

hexed basin
#

👍

molten kernel
#

leaderstats updated correctly

hexed basin
#

If u got more question u can dm me

molten kernel
#

sounds good 👍