local t = script.Parent local plr = t.Parent.Parent.Parent plr:WaitForChild("stats") local l = plr.leaderstats.level local e = plr.stats.exp while true do t.Text = "Level "..l.Value": "..e.Value"/50" end
attempt to call a number value (line7) anyonehelp?
Quite a few bugs in this code. On line 6 your While loop has no wait() in it, this will cause this script to hang and error out also some formatting in your text string is malformed.
This is the correct code that should run:
local t = script.Parent local plr = t.Parent.Parent.Parent plr:WaitForChild("stats") local l = plr.leaderstats.level local e = plr.stats.exp while wait() do -- wait a game tick each loop wait() returns true once it's done waiting! t.Text = "Level "..tostring(l.Value)..": "..tostring(e.Value).."/50" -- the tostring() function just simply makes sure we're dealing with a string and not a nil, So even in some Value comes back as nill it will print a string nil!. end
Also the error is erroring out with a Number value because you're trying to join a string and a number together to form a string. The above example should sort this out! EG:
local v = "some text ["..( 1 ).. "] woot!"
this would be ok with code but Text fields in guis only accept strings(text) so to help thi compute i would change this to...
local v = "some text ["..tostring( 1 ).. "] woot!"
Hope this helps! :)