Is there a way to check if a value has changed?

I have a running script and when the value is true I make it so they are faster and it plays a animation, is there a way to check when it turns true/false?

Yes, all boolean values have a .Changed event.

I think Instance:GetPropertyChangedSignal event is what you are looking for because it will only fire when the given property changes.

Example:

local BoolValue = path to Instance

BoolValue:GetPropertyChangedSignal("Value"):Connect(function()
	-- code
end)
2 Likes

An easier way for detecting changes for values is

local value = yourValue
value.Changed:Connect(function()
    local newVal = value.Value
    print(value.Name.." has changed to: "..newVal)
end)
1 Like
local value = yourValue
value.Changed:Connect(function(newVal)
	print(value.Name.." has changed to: "..newVal)
end)
2 Likes