So I wanted to ability to swap tools when pressing "q", I get no errors (I've never done this before). Am I approaching this the correct way, or am I doing something wrong?
Please note that this is not the whole script
repeat wait() Player = game.Players.LocalPlayer until Player repeat wait() leaderstats = Player:FindFirstChild("leaderstats") until leaderstats local Mouse = Player:GetMouse() local Prim = true local Ak47 = Player.Backpack:FindFirstChild("AK47") local M9 = Player.Backpack:FindFirstChild("M9") function SwapW(Ep, De) if (Ep) and (De) then De.Parent = Player.Backpack Player.Character.Humanoid:EquipTool(Ep) end end leaderstats.InHeist.Changed:connect(function() if leaderstats.InHeist.Value == true then SwapW(Ak47, M9) end end) Mouse.KeyDown:connect(function(key) if key == "q" then if leaderstats.InHeist.Value == true then if Prim then Prim = false SwapW(M9, Ak47) elseif not Prim then Prim = true SwapW(Ak47, M9) end end end end)