Textlabel Not Changing

Hello Developers!

I’m currently scripting a football scoreboard and need a tad bit of help.

I have all my values in ReplicatedStorage, but I’m currently trying to make it that once the value is changed, change the text label.

The button on the control panel works accordingly, once I set the record to 12-0, it changes the Replicated Value.

However, it doesnt change the record’s text label in the top right.

Here is the script in the record that’s supposed to display the value.

for i,v in pairs(game.ReplicatedStorage.GameValues:GetChildren()) do
	v.Changed:Connect(function()
		script.Parent.Text = game.ReplicatedStorage.GameValues.HRecord
	end)
end

However, it’s not displaying, and just staying as 0-0, the starter text.

Any help?

1 Like

I think you have most likely just forgotten to set it to the Value property of the HRecord object. This code may work:

for i,v in pairs(game.ReplicatedStorage.GameValues:GetChildren()) do
	v.Changed:Connect(function()
		script.Parent.Text = game.ReplicatedStorage.GameValues.HRecord.Value
	end)
end

I hope this helps

1 Like

im so stupid, thank you so much, i legit made a whole devforum post over something so simple.

:sob:

1 Like

Can you help with one more thing?

How do I make it that all players can see the change? The label changes for that one player but the other players in the server don’t see the change.

I felt like since it would be a “server issue”, I would make just a script instead of local, however this doesn’t work.

1 Like

You would most likely have to change the value on the server and then use a remote event so send a signal to the client to update the text label or you could also use GetPropertyChangedSignal(“Value”) to detect when the value is changed from a local script and then update it whenever the Value property changes.

If you’re unsure on either of these try these links for more info:
Remote Events Documentation
GetPropertyChangedSignal() Documentation

2 Likes

I tried doing this;


local function onRecordChange()
	for i,v in pairs(game.ReplicatedStorage.GameValues:GetChildren()) do
		v.Changed:Connect(function()
			script.Parent.Text = game.ReplicatedStorage.GameValues.ARecord.Value

		end)
	end
end

local recordRemote = game.ReplicatedStorage.GameValues.ARecord

recordRemote:GetPropertyChangedSignal("Value"):Connect(onRecordChange)

Sadly didn’t work, I’ll do a bit more research.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.