Why does this not work?

Why doesn’t this simple code not work?

the value is a int value and its a local script inside of a text label.

local value = script.Parent.Value

while true do
wait()
script.Parent.Text = value.Value
end

1 Like

I recommend to use value .Changed instead or :GetPropertyChangedSignal. Also check where the value is as your code seems like it should work.

1 Like

I’ll see what I can do, thanks.

The value doesnt seem to be out of the ordinary.

Where is the TextLabel located?

1 Like

the value is inside of the text label if you were wondering.

What is the TextLabel’s Parent as it needs to be a ScreenGUI, SurfaceGUI or BillboardGUI or to another element inside of these GUI options

1 Like

It is inside of a screen gui. I have no idea why it doesnt work.

What it looks like if I might be wrong
image

This is what i got right now

local text = script.Parent
local value = text.Value

value.Changed:Connect(function()
script.Parent.Text = value.Value
end)

That looks fine to me this seems very weird to why it’s not working as I tried the script and it worked fine.
Maybe try this script instead see how it goes.

local value = script.Parent.Value

script.Parent.Text = tonumber(value.Value) -- Default Value

value.Changed:Connect(function()
	script.Parent.Text = tonumber(value.Value) -- Update to new Value when changed
end)

I’ll test this out thanks for helping me.

Unfortunately it didnt work. Any other ideas on why It wouldnt work?

This is my script where I apply value to my int value maybe it has something to do with this.

local scoreboard = game.StarterGui.ScreenGui

local teamAScore = scoreboard.TeamAScore.Value

local teamBScore = scoreboard.TeamBScore.Value

local ball = game.Workspace.Ball

local goalA = game.Workspace.GoalA
local goalB = game.Workspace.GoalB

ball.Touched:Connect(function(hit)
if hit == goalA then
ball.CFrame = workspace.SpawnLocation.CFrame + Vector3.new(0,10,0)
print(“goal”)
teamAScore.Value = teamAScore.Value + 1
elseif hit == goalB then
print(“goal”)
teamBScore.Value = teamBScore.Value + 1
ball.CFrame = workspace.SpawnLocation.CFrame + Vector3.new(0,10,0)
end
end)

Can I see what comes up in the textbox when the game is running to see if it changes at all? The goal scoring script should not affect it as it only changes the value when a goal is scored and should update the value to appear in the text box.

Sure, Ill show you what it does.

The text didnt change but the int value did.

Let me make a print when the value.Changed thing goes.

value.changed doesnt do anything

i put a print after value.changed and it doesnt work