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

Why is my NumberValue not showing on text?

Asked by 2 years ago

script1 path: game.StarterGui.AgilityValue.AgilityValueChange

01local agility = script.Parent.Value
02local function onRunning(speed)
03game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Running:Connect(onRunning)
04if speed >0 then
05        timeStarted = time()
06    else
07        local agilitygain = (time()-timeStarted)
08        agility = (agility+agilitygain)
09        agility = math.floor(agility)
10        script.Parent.Value = (agility)
11        end
12    end

ok, so this script successfully changes the value of AgilityValue. But, in the other script i have,i am facing an issue.

script2 path: game.StarterGui.ScreenGui.Menu.MenuGUI.StatFrame.Agility.AgilityValueScript

1local agility = game:GetService("StarterGui").AgilityValue.Value
2local agilityText = script.Parent.Text
3game.StarterGui.AgilityValue.Changed:Connect(function()
4    agilityText = ("Agility:")..agility
5end)

Even though I am using the right path of agility, the agilityText remains as "Agility:" without showing the agility value next to it.

I would really appreciate it if someone helped me out, thanks :D

0
Changing the text from StarterGui will only change the text for players who join after you change it. StarterGui clones itself into players when they join, so you'll have to change it within the player instead brandons2005 87 — 2y

1 answer

Log in to vote
1
Answered by
MpAlex 16
2 years ago

try changing

1local agility = game:GetService("StarterGui").AgilityValue.Value

to

1local agility = game:GetService("Players").LocalPlayer.PlayerGui.AgilityValue.Value

i think you need to access the value from inside the player

0
I tried it and it didn't work but thanks for answering :) antonisthegod 12 — 2y
Ad

Answer this question