When I press a button, a bool value changes. How do I make it run a function when the bool value changes? I want the function to activate when the bool value changes. Here's my script. Thanks.
local ChargeValue = script.Parent.Parent.Stats.Actions.Charge local function ChargeAction() print("Value Changed") end ChargeValue.Changed:Connect(ChargeAction) ChargeValue.Value = false
First, check if the changed property is actually the Value, then run the function, and last thing is to make the value false.
ChargeValue:GetPropertyChangedSignal("Value"):Connect(function() ChargeAction() ChargeValue.Value = false end)