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

How do I make the Parent textlabel's Text to the exp value whenever it changes?

Asked by 8 years ago
Edited 8 years ago
local player = game.Players.LocalPlayer
local exp = player.PlayerScripts:WaitForChild("Running script").exp
    exp.Changed:connect(function(newValue)
        script.Parent.Text = newValue
    end)

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago
Edited 8 years ago

Your Problem

When you reference the value, you're getting it from game.StarterPlayer.StarterPlayerScripts. That is not the location of the value inside the client. When the player joins, everything in StarterPlayerScripts is cloned into Player.PlayerScripts

Your code is correct :) you just need to reference the value correctly.


Code

This should be in a localscript.

local plr = game.Players.LocalPlayer;
--retrieve from plr.PlayerScripts
local exp = plr.PlayerScripts:WaitForChild("Running script").exp;

exp.Changed:connect(function(newValue)
    script.Parent.Text = newValue;
end)
0
text isn't changing, and infinite yield possible UsernameEqualsTaken 30 — 8y
0
nevermind, thanks UsernameEqualsTaken 30 — 8y
Ad

Answer this question