I'm making an animation script that uses welds that change C0s and C1s with lerp running on a Heartbeat function. I need to be able to stop the Heartbeat function when the welds C0 is the desired offset, however, "break" only works on loops. Is there any alternative to using break on a function?
local desired = CFrame.new(0,0,0) local signal = nil --We have to declare the signal first because we are disconnecting it when we initialize it local weld = nil signal = game:GetService("RunService").Heartbeat:Connect(function() if weld.C0 == desired then signal:Disconnect() signal = nil end end)