local player=game.Players.LocalPlayer local y=1 local l=1 local tools={ E=game.Lighting["Baton"]:Clone(); Q=game.Lighting["BillyClubRiotShield"]:Clone(); R=game.Lighting["LE-AR"]:Clone(); F=game.Lighting["LE-P1"]:Clone(); G=game.Lighting["LE-S1"]:Clone(); } game:GetService("UserInputService").InputBegan:connect(function(inputObject) if inputObject.KeyCode.Name=="Slash"then while l == 1 do y=3 player.Character.Humanoid:UnequipTools() if inputObject.KeyCode.Name=="Return"then l=2 end print "yay" wait() end l=1 y=1 else local tool=tools[inputObject.KeyCode.Name] if tool then if y==1 then player.Character.Humanoid:EquipTool(tool) y=2 if inputObject.KeyCode.Name == "E" then player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(13/255,120/255,177/255) elseif inputObject.KeyCode.Name == "Q" then player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(13/255,120/255,177/255) elseif inputObject.KeyCode.Name == "R" then player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(13/255,120/255,177/255) elseif inputObject.KeyCode.Name == "F" then player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(13/255,120/255,177/255) elseif inputObject.KeyCode.Name == "G" then player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(13/255,120/255,177/255) end elseif y==2 then player.Character.Humanoid:UnequipTools() if inputObject.KeyCode.Name == "E" then player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255) elseif inputObject.KeyCode.Name == "Q" then player.PlayerGui.InventoryGui.Frame.Frame.Q.BorderColor3=Color3.new(27/255,42/255,53/255) elseif inputObject.KeyCode.Name == "R" then player.PlayerGui.InventoryGui.Frame.Frame.R.BorderColor3=Color3.new(27/255,42/255,53/255) elseif inputObject.KeyCode.Name == "F" then player.PlayerGui.InventoryGui.Frame.Frame.F.BorderColor3=Color3.new(27/255,42/255,53/255) elseif inputObject.KeyCode.Name == "G" then player.PlayerGui.InventoryGui.Frame.Frame.G.BorderColor3=Color3.new(27/255,42/255,53/255) end y=1 end end end end)
the part that's not working is if inputObject.KeyCode.Name=="Enter"then
and i don't understand why slash works but not enter
The name is actually "Return" in the KeyCude Enum array.
edit:
The if statement confirms that the KeyCode is Slash. Inside the if statement is a while loop that checks if it is equal to Return. It is not equal to Return, though, because it is equal to Slash. The argument passed to the event isn't going to change; the event is going to be fired another separate time if you press a key again, so you need to check for that:
local player=game.Players.LocalPlayer local y=1 local l=1 local tools={ E=game.Lighting["Baton"]:Clone(); Q=game.Lighting["BillyClubRiotShield"]:Clone(); R=game.Lighting["LE-AR"]:Clone(); F=game.Lighting["LE-P1"]:Clone(); G=game.Lighting["LE-S1"]:Clone(); } game:GetService("UserInputService").InputBegan:connect(function(inputObject) if inputObject.KeyCode.Name=="Slash"then while l == 1 do y=3 player.Character.Humanoid:UnequipTools() print "yay" wait() end l=1 y=1 elseif inputObject.KeyCode.Name=="Return"then l=2 else local tool=tools[inputObject.KeyCode.Name] if tool then if y==1 then player.Character.Humanoid:EquipTool(tool) y=2 player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(13/255,120/255,177/255) elseif y==2 then player.Character.Humanoid:UnequipTools() player.PlayerGui.InventoryGui.Frame.Frame.E.BorderColor3=Color3.new(27/255,42/255,53/255) y=1 end end end end)