:GetPropertyChangedSignal(“VaIue”) Not Work For ValueObject
I Had Research And I Don’t Fin Any Problem
My Script
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("valuestats")
local leader = player:WaitForChild("leaderstats")
local streak = stats:WaitForChild("Streak")
local coins = leader:WaitForChild("Coins")
local tickets = stats:WaitForChild("FloorTicket")
local streaktext = script.Parent.Streak
local coinstext = script.Parent.Coins
local tickettext = script.Parent.FloorTicket
local function update()
streaktext.Text = streak.Value .. " Floor"
coinstext.Text = coins.Value .. "⊕"
tickettext.Text = tickets.Value .. "🅵"
end
update()
actually im pretty sure its because you’re not passing anything into your update function
you’re still using the old values of streak when it was defined previously
you need to pass the new value as a parameter for it to update properly
Hello, when you’re calling streak:GetPropertyChangedSignal("VaIue") you’re using a capital I instead of a lowercase l.
Here is the fixed script.
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("valuestats")
local leader = player:WaitForChild("leaderstats")
local streak = stats:WaitForChild("Streak")
local coins = leader:WaitForChild("Coins")
local tickets = stats:WaitForChild("FloorTicket")
local streaktext = script.Parent.Streak
local coinstext = script.Parent.Coins
local tickettext = script.Parent.FloorTicket
local function update()
streaktext.Text = streak.Value .. " Floor"
coinstext.Text = coins.Value .. "⊕"
tickettext.Text = tickets.Value .. "🅵"
end
update()
streak:GetPropertyChangedSignal("Value"):Connect(update)
coins:GetPropertyChangedSignal("Value"):Connect(update)
tickets:GetPropertyChangedSignal("Value"):Connect(update)
I Code In Notepad Or You Can Say I Code On A Phone And You Know I Caplock My Word So When I Go On PC And Paste. I Won’t Nocited Bc It Was My 4 Day Deadline On The Project. So That How-
Value instances already have a built-in “Changed” event that fires whenever the value instance’s “Value” property changes, the new value is subsequently passed to any function connected to it. Additionally, you should have a different function handle each value change.
local function updatestreak(value)
streaktext.Text = value .. " Floor" --no need to index streak's "Value" property as the new value is passed as an argument to the function
end
local function updatecoins(value)
coinstext.Text = value .. "⊕"
end
local function updateticket(value)
tickettext.Text = value .. "🅵"
end
streak.Changed:Connect(updatestreak)
coins.Changed:Connect(updatecoins)
tickets.Changed:Connect(updateticket)
update()