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

Title updater working in the studio, but not in-game? [SOLVED]

Asked by 4 years ago
Edited 4 years ago

Hi there! I'm having an issue with my game title updater. It's supposed to refresh the text at the top of the screen so you know what's going on, like the intermission and so on. The updater works perfectly in the studio, but when I test it on the actual Roblox platform in-game, it returns with the error message: attempt to call userdata value. I have tried putting a delay on the function so it gives a little time for the player to join in before it starts running, but it doesn't seem to work. Here is the code below:

game("GetService","RunService").RenderStepped:connect(function()
    ui:WaitForChild("Title").Text = game.Workspace.Game.Stats.Status.Value
end)

A couple things:

-The ui is the ScreenGui that holds the text.

-The game.Workspace.Game.Stats.Status.Value is the value that you can change to change the text at the top of the screen.

If someone could take a look at this and help, that would be greatly appreciated!

0
That is a deprecated form of reference, frankly I’m shocked to see it. Use game:GetService("RunService") instead. Or, optionally connect a GetPropertyChangedSignal to the Status Value and load in the new Text this way. Ziffixture 6913 — 4y
0
Thank you so much! I have been wrestling with this problem for a long time! Can you please put that comment as an answer so I can give you credit? blarp_blurp645 63 — 4y
0
Ha, thank you! Ziffixture 6913 — 4y

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

That is a deprecated form of reference, frankly I’m shocked to see it. Use game:GetService("RunService") instead. Or, optionally connect a GetPropertyChangedSignal to the Status Value and load in the new Text this way.

local Status = workspace.Game.Stats.Status

Status:GetPropertyChangedSignal("Value"):Connect(function(Changed)
    print(Changed)
end)
Ad

Answer this question