Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why does it not change the text when the value is changed?

Asked by 7 years ago
Edited 7 years ago
local leaderstats = game.Players.LocalPlayer.leaderstats
local level = leaderstats.Level
local exp = level:WaitForChild("EXP") 
local levelDisplay = script.Parent.Level
local expDisplay = script.Parent.Exp

exp.Changed:Connect(function()
expDisplay.Text = "Exp: "..exp.Value "/1000"    
end)
level.Changed:Connect(function()
    levelDisplay.Text = "level: "..level.Value  
end)

changing the level works but not the exp i get an error Error attempt to call field 'Value' (a number value)

local script in a screenGUI

2 answers

Log in to vote
1
Answered by
mraznboy1 194
7 years ago

You're gonna hate yourself for this, but you missed the concatenation ".." here:

expDisplay.Text = "Exp: "..exp.Value.. "/1000"
0
oh i didnt know you needed it on both ends EpicAshtonTheBoy 33 — 7y
0
ive never done it with text on both ends EpicAshtonTheBoy 33 — 7y
0
Yup, any time you connect strings together, you'll need it in between. mraznboy1 194 — 7y
0
ok thx EpicAshtonTheBoy 33 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Try this:

local Player = game.Players.LocalPlayer
repeat wait() until Player.leaderstats
local leaderstats = Player.leaderstats
0
it can get leaderstats it just cant change the exp display to exp value EpicAshtonTheBoy 33 — 7y
0
lol you didn't seem to even read the question, someone answered above you, look at the question carefully and at the answer. Arti_BLOX 58 — 7y

Answer this question