What do you want to achieve?
I have a LocalScript (its in startergui/playergui) to recognize a value(its in player too). However, i also want to continuously update this value in a text within the PlayerGUI. But currently, it only stays with the initial form when i start the server and does not update the text when the value changes
local player = game.Players.LocalPlayer
local Datas = player.Datas
local Points = player.Datas.Points
--CODE--
local PointsText = player.PlayerGui.PointsShowGui.PointsShow
local function updateText()
PointsText.Text = "POINTS: "..Points.Value
end
updateText()
Points.Changed:Connect(updateText())
How can i solve it to that when value changes my text everytime changes too
The problem is most likely that you are changing the value on a local script. For the server to be able to read the new information, the value has to be changed on a server script. Try using remote events if you need.
local player = game.Players.LocalPlayer
local Data = player.Data
local Points = Data:WaitForChild("Points")
local PoinsText = script.Parent -- Put the script in the Label
PointsText.Text = "POINTS: "..Points.Value
Points:GetPropertyChangedSignal("Value"):Connect(function()
PointsText.Text = "POINTS: "..Points.Value
end)
The Changed event for all objects that inherit ValueBase are different. Changed will only fire on these objects if their value is changed, not if any property is changed.