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 1 year ago

script1 path: game.StarterGui.AgilityValue.AgilityValueChange

local agility = script.Parent.Value
local function onRunning(speed)
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Running:Connect(onRunning)
if speed >0 then
        timeStarted = time()
    else
        local agilitygain = (time()-timeStarted)
        agility = (agility+agilitygain)
        agility = math.floor(agility)
        script.Parent.Value = (agility)
        end
    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

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

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 — 1y

1 answer

Log in to vote
1
Answered by
MpAlex 16
1 year ago

try changing

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

to

local 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 — 1y
Ad

Answer this question