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

Remotely Modifying a TextLabel's Text Value?

Asked by
RoboFrog 400 Moderation Voter
10 years ago

Alright, this is a decent complex question, so please excuse any excess information.

The script itself is supposed to change the value of a TextLabel according to the value of an IntValue located elsewhere. Here's the script itself:

local gpath = game.StarterGui.BackFrame.Midframe
local ipath = game.Workspace.Tycoon.Tycoon.InvInt
local uupdate = game.Workspace.Tycoon.Tycoon.InvInt.Stone, game.Workspace.Tycoon.Tycoon.InvInt.StoneB

function TUpdate()

gpath.StoneFrame.ore.Text = (tostring(ipath.Stone.Value))
gpath.StoneFrame.bar.Text = (tostring(ipath.StoneB.Value))

end

uupdate.Changed:connect(TUpdate)

Now, the explorer itself looks like this:

[-] Workspace
    [-] Tycoon (Model)
        [-] Tycoon (Model)
            [-] InvInt (IntValue)
                InvMain (Script (Code Above!))
                Stone (IntValue)
                StoneB (IntValue)

[-] Starter Gui
    [-] ScreenGui (ScreenGui)
        [-] BackFrame (Frame)
            [-] MidFrame (Frame)
                [-] StoneFrame (Frame)
                    Bar (TextLabel)
                    Ore (TextLabel)

** - The Problem - **

I'll be flat-out honest -- nothing in this seems to work. I go into "Play Solo" mode, and whenever I manually modify the Stone IntValue the GUI TextLabel won't change accordingly. I can also even manually change the TextLabel, and I still fail to see a visual change. If possible, I really need to keep the script out of the StarterGui, and somewhere in the Tycoon model.

Hopefully this is enough information, and any help is much appreciated!

2 answers

Log in to vote
-1
Answered by 10 years ago

You have to do something like this:

script.Parent.etc....

Not game.Workspace.etc...

0
game.Workspace.etc has worked for me many times with many other scripts. Might I ask why it's different in this case? RoboFrog 400 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

First script line 12 spelling error

"uupdate.Changed:connect(TUpdate)"

0
"uupdate" is a local variable listed at the top of the script, and is not a spelling error. RoboFrog 400 — 10y

Answer this question