I'm very new to scripting, here is the script
clickDetector = game.workspace.Box.top.ClickDetector
function onMouseClick() game.Workspace.Box.bottom.Transparency = 0 game.Workspace.Box.top.Transparency = 1
local num = math.random(1,5) if num == 1 then print("1") elseif num == 2 then print("2") elseif num == 3 then print("3") elseif num == 4 then print("4") elseif num == 5 then print("5") end wait(3) game.Workspace.Box.bottom.Transparency = 1 game.Workspace.Box.top.Transparency = 0
end clickDetector.MouseClick:connect(onMouseClick)
It us fairly easy to make a debounce:
clickDetector = game.workspace.Box.top.ClickDetector loal debounce = true function onMouseClick() if debounce then debounce = false game.Workspace.Box.bottom.Transparency = 0 game.Workspace.Box.top.Transparency = 1 local num = math.random(1,5) if num == 1 then print("1") elseif num == 2 then print("2") elseif num == 3 then print("3") elseif num == 4 then print("4") elseif num == 5 then print("5") end wait(3) game.Workspace.Box.bottom.Transparency = 1 game.Workspace.Box.top.Transparency = 0 debounce = true end end clickDetector.MouseClick:connect(onMouseClick)
Please note, I wrote this answer on mobile after waking up, so if there is any problem with this please tell me.