Callback

Roblox uses functions that can be passed as parameters, acting similarly to callbacks.
local function completeTask(callback)
    print("Performing task")
    wait(2)  -- Simulating task duration
    callback("Task completed successfully")
end

local function taskCallback(result)
    print("Callback received:", result)
end

completeTask(taskCallback)
Image 1
Roblox Studio

If you found this tutorial helpful and would like to support my work, please consider buying me a coffee.

Thank you very much for your support!

Buy me a coffee