The way my shop works is there's a large room with the item you can buy. Next to each item is a platform that opens a gui to purchase it. When you press Z, it should buy the item. When you press X, it should close the gui. Z isn't working. Here is my script.
local UserInputService = game:GetService("UserInputService") local plr = game.Players.LocalPlayer local function onInputBegan(input, gameProcessed) if input.KeyCode == Enum.KeyCode.Z and not gameProcessed then -- added a check for gameprocessed incase they were writing in chat if plr.leaderstats.Cash.Value >=20 then plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value - 20 game.ReplicatedStorage.Library.AssaultRifle:Clone().Parent = plr:WaitForChild('Backpack') end end end UserInputService.InputBegan:Connect(onInputBegan)