So I have a function, and if it is running, then I want to trigger a piece of code. But I don't really know how to call my function. I haven't tried anything because I couldn't find anything. So please help. Thanks!
EDIT: The code that I want to be triggered, is the following.
for key, value in pairs(workspace:GetDescendants()) do if value.Name == "car" then value:Destroy() end end
local function Checker() script.Checker.Value = true --Add a BoolValue inside the script and name it "Checker" wait(2) --Instead of the wait you can add your own code here script.Checker.Value = false end while wait() do Checker() if script.Checker.Value == true then print("The function is running") -- Do something instead of the print else print("The function is not running") -- Do something instead of the print end end
function Check() -- if you change "Check" then change the bottom check to the name of the function print("function check is running") -- Name Check to whatever your function name is -- put code in here end Check() -- change "Check" to your function name