Heres my code [In a localscript]
local player = game.Players.LocalPlayer local Cookies = player.leaderstats.Cookies Cookies.Value.Changed:Connect(function() script.parent.Text = "Cookies value has changed" end)
The error i get
Players.Krosloe.PlayerGui.Shield.TextLabel.LocalScript:4: attempt to index field 'Value' (a number value)
First, you could just remove the .Value
to achieve what you want. However, here's a more efficient way:
local player = game.Players.LocalPlayer local cookies = player.leaderstats.Cookies Cookies:GetPropertyChangedSignal('Value'):Connect(function() script.Parent.Text = 'Cookies value has changed' end)
Hope I helped!
Easy Fix, You don't need to use Value.Changed for that...
local player = game.Players.LocalPlayer local Cookies = player.leaderstats.Cookies if Cookies.Value >= 1 then script.parent.Text = "Cookies value has changed" end)
Pretty simple actually, i changed it to scan if the cookies value goes above 1, and complete the action below it.
I suggest using a while true do to always scan.