Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would i make a Hotbar wait 3 seconds before switching slots?

Asked by 4 years ago

I want to make a Hotbar wait before switching to the next slot. For example if someone pressed "1" my script would sense that and trigger a GUI system that would count down from 3 until that slot can be switched too.

I'm confused on how I would reference the Hotbar the different Hotbar slots. Can anyone help me?

Thanks here is what I've got so far:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()


mouse.KeyDown:connect(function(key)
    if key == "1" then 
        wait(3)
        -- here is where I want to reference the Hotbar to switch to the pressed key
    end 
end)

Answer this question