#adding leaderstat to gui
1 messages · Page 1 of 1 (latest)
doesnt seem to work. it shows the leaderstat working but not the text
text to Text and value to Value
i did that and it didnt change anything
Text and value starting with captial letters
moneycounter.Text = ("Money = ".. Moneyleaderstat.Value)
What exactly doesnt work, any errors or is it the behaviour?
well the gui that should tell you how much wood you have isnt changing.
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
like what i want it to do is match up with the leaderstat
This is a local script right?
its a normal script. should it be a local?
Udim2 always needs 4 numbers
it worked with 2 for me tho
I never tried guis with server scripts i usually do it with locals so idk
so just copy and paste everything into the local script?
Its worth a try
also string <> number, u cant do that u must concatenate
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.
Its pretty late in my timezone, sorry if it doesnt help
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.
** You are now Level 1! **
I dont really know how to fix it rn im pretty tired and wouldve chosen a completely different approach
this isnt in a local script though. Is that partly why it isnt working?
Meanwhile you can also try to use chat gpt and Claude, for these small problems they do a good job
ok
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