- What do you want to achieve?
A working system that works when the value is changed
- What is the issue?
The issue is it doesn’t work when the value changes
- What solutions have you tried so far?
Finding a solution!
local player = game:GetService("Players")
player:WaitForChild("BackPackValues")["Red Backpack"]:GetPropertyChangedSignal("Value"):Connect(function()
if player:WaitForChild("BackPackValues")["Red Backpack"].Value == false then
if player.leaderstats.Coins.Value >= 100 then
player.CapacityArrow.Value = true
else
player.CapacityArrow.Value = false
end
end
end)
Thank you in advance!
For ValueObjects (NumberValue, ObjectValue, IntValue, etc.), you can use .Changed, since it has a special .Changed event that only runs when the value changes, and it also passes the value along with it. If we do this, it would change to this:
local player = game:GetService("Players")
local Stat = player:WaitForChild("BackPackValues")["Red Backpack"]
Stat.Changed:Connect(function(Value)
if not Value then
if player.leaderstats.Coins.Value >= 100 then
player.CapacityArrow.Value = true
else
player.CapacityArrow.Value = false
end
end
end)
If this doesn’t work, the issue is most likely elsewhere OR the value is never true.
I want it so if the value is false then it would do something else if it isn’t then it won’t do it
I don’t think it is a changed event!