For the slot system you can make value that will increase every time you press the Q button, and if the slot is higher than your max then reset it back to default.
local UserInputService = game:GetService('UserInputService')
local debounce = false
local slot = 1
local maxSlots = 10
UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.Q and debounce == false then
print(slot)
slot = (slot % maxSlots) + 1
end
end)
Basically the line with adding slot what it does:
It adds +1 to the slot, and it uses the modulus operator on the number, the modulus returns how much is left when divided by the number so: 10 % 2 = 0 left but 10 % 4 = 2, because 4 can fit 2 times into 10 but 4*2 = 8 so 10 - 8 is 2 which is the number it returns.
about %
EDIT:
Here is how to split it into 2 lines
UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.Q and debounce == false then
print(slot)
slot = (slot + 1)
...
slot = slot%maxSlots
end
end)
4 comments
i forgot some parts of my script because i did this aweek ago so this is what is left
noone answer this
Is this using the default Roblox backpack?
yes