Advertisement
oopsrainbow4

Equip and Unequip Sword#2

Jul 20th, 2022
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. local rp = game:GetService("ReplicatedStorage")
  2. local Sword = rp:WaitForChild("Sword")
  3.  
  4. local UIS = game:GetService("UserInputService")
  5. local isEquipped = false
  6. local debounce = false
  7. local cd = 1
  8.  
  9. UIS.InputBegan:Connect(function(input,isTyping)
  10.     if not isTyping then
  11.         if input.KeyCode == Enum.KeyCode.E then
  12.             if not isEquipped then
  13.                 isEquipped = true
  14.                
  15.                 Sword:FireServer(isEquipped)
  16.             elseif isEquipped and not debounce then
  17.                 debounce = true
  18.                 isEquipped = false
  19.                    
  20.                 Sword:FireServer(isEquipped)
  21.             end
  22.         end
  23.     end
  24. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement