#adding leaderstat to gui

1 messages · Page 1 of 1 (latest)

fickle briar
#

I want to have my gui to say the name of the object and how much the player has in a textlabel. The amount is in the leaderstat but I also want to show it in the text label. when i do it, it says i cant have a comma. for example moneycounter.text = ("Money =", Moneyleaderstat.value)

sturdy garnet
#

try this

#

moneycounter.text = ("Money = ".. Moneyleaderstat.value)

fickle briar
#

doesnt seem to work. it shows the leaderstat working but not the text

glacial wadi
fickle briar
#

i did that and it didnt change anything

ebon moss
#

Text and value starting with captial letters

#

moneycounter.Text = ("Money = ".. Moneyleaderstat.Value)

fickle briar
#

its not working idk why

#

hold on im going to send the script

ebon moss
#

What exactly doesnt work, any errors or is it the behaviour?

fickle briar
#

well the gui that should tell you how much wood you have isnt changing.

wooden crypt
#

in Lua u cant join strings and numbers with commas like in some other languages, u need to concatenate them with .. and convert non-strings with tostring

fickle briar
#

like what i want it to do is match up with the leaderstat

ebon moss
#

This is a local script right?

fickle briar
#

its a normal script. should it be a local?

wooden crypt
#

Udim2 always needs 4 numbers

fickle briar
#

it worked with 2 for me tho

ebon moss
fickle briar
#

so just copy and paste everything into the local script?

ebon moss
#

Its worth a try

wooden crypt
#

also string <> number, u cant do that u must concatenate

fickle briar
# ebon moss Its worth a try

so there is another problem that happens when i do that. It removes the leaderstat. so if i were to do the local script i would just need the function and some local things. but, i would need to reference the leaderstat but i cant because its in a different script.

ebon moss
#

Its pretty late in my timezone, sorry if it doesnt help

wooden crypt
#

label.Text = ("Wood =", wood.Value) should be like this label.Text = "Wood = " .. wood.Value

#

also GUI parenting, in a localscript u should parent ur screengui to the playergui, not startergui

#

also the player detection, inside touched, u get a hit part so u check hit.Parent:FindFirstChild("Humanoid") then GetPlayerFromCharacter to make sure it was you who touched it.

reef tigerBOT
#

studio** You are now Level 1! **studio

ebon moss
fickle briar
ebon moss
#

Meanwhile you can also try to use chat gpt and Claude, for these small problems they do a good job

fickle briar
#

ok

wooden crypt
#

startergui is just a template, anything u put in startergui on the server will be cloned into each player's playergui when they join, once the game is running, the client only ever sees and updates their own playergui, they dont have a live reference to startergui anymore

#

in short, startergui -> initial template on the server -> gets copied into playergui on the client -> u should script aginst playergui