rs = game:GetService("ReplicatedStorage") rs.RemoteEvents.FireAnigilation.OnServerEvent:Connect(function(player, Mouse) print("LoL, u will not stop me") wait(10) print("U lose!") end) rs.RemoteEvents.FireAnigilationEnd.OnServerEvent:Connect(function(player, Mouse) print("Yey, i win!") end)
You have to have use a variable to keep track of whether the first function should continue or not. For instance, you might set shouldContinue = true
when the first function starts running, then shouldContinue = false
if it should be cancelled, and then the first function should run if not shouldContinue then return end
every time the variable may have changed (after every yield/wait)