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

Why is my NumberValue not showing on text?

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

1 comment

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

1 answer

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

1 comment

0

I tried it and it didn't work but thanks for answering :)

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