Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Remotely Modifying a TextLabel's Text Value?

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

You have to do something like this:

script.Parent.etc....

Not game.Workspace.etc...

1 comment

0

game.Workspace.etc has worked for me many times with many other scripts. Might I ask why it's different in this case?

First script line 12 spelling error

"uupdate.Changed:connect(TUpdate)"

1 comment

0

"uupdate" is a local variable listed at the top of the script, and is not a spelling error.

This discussion is preserved as it was. New answers, comments, and votes are closed.