HPAI · Complete source example · Studio execution pending

The complete Roblox coin script and setup

Studio has not been run here, so no finished Studio screenshot or verified Roblox outcome is claimed.

Exact object setup and tests

What the script does

One shared coin awards a player one point, hides for three seconds, then returns. The score is a player attribute. There is no gate, permanent save or leaderboard display in this increment.

local Players = game:GetService("Players")
local coin = script.Parent
local cooldown = 3
local available = true
local originalTransparency = coin.Transparency

coin.Touched:Connect(function(hit)
    if not available then return end
    local character = hit:FindFirstAncestorOfClass("Model")
    local player = character and Players:GetPlayerFromCharacter(character)
    if not player then return end

    available = false
    local score = player:GetAttribute("TutorialCoins") or 0
    player:SetAttribute("TutorialCoins", score + 1)
    print(player.Name, "coins:", score + 1)
    coin.Transparency = 1
    coin.CanTouch = false

    task.delay(cooldown, function()
        if not coin.Parent then return end
        coin.Transparency = originalTransparency
        available = true
        coin.CanTouch = true
    end)
end)

Try the rule model

The preceding design tutorial has a working browser model. It helps explain shared cooldowns, but does not establish that this Luau script works in Studio.

Studio test results are still marked NOT RUN.