I'm trying to see if I can identify the previous key pressed. I want to know so that I can make sure the last gun I used is nil and that I can use the new gun I am currently using.
local CurrentGun
local PrevGun = ?
InputService.InputBegan:connect(function(key, gpe)
if key.KeyCode == Enum.KeyCode.One or key.KeyCode == Enum.KeyCode.KeypadOne and not gpe then
local PP = PPart:Clone()
PP.Parent = Character
CurrentGun = PP
elseif key.KeyCode == Enum.KeyCode.Two or key.KeyCode == Enum.KeyCode.KeypadTwo and not gpe then
local SP = SPart:Clone()
SP.Parent = Character
CurrentGun = SP
elseif key.KeyCode == Enum.KeyCode.Three or key.KeyCode == Enum.KeyCode.KeypadThree then
local BP = BPart:Clone()
BP.Parent = Character
CurrentGun = BP
end
end)
