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.
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
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.
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)