local UserInputService = game:GetService("UserInputService")
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local player = game.Players.LocalPlayer
UserInputService.InputBegan:Connect(function(input)
local slot1 = script.Parent.Slot1.TextLabel.Text
local slot2 = script.Parent.Slot2.TextLabel.Text
if input.KeyCode == Enum.KeyCode.One then
local tool = player.Backpack:FindFirstChild(slot1)
if tool and tool:IsA("Tool") then
humanoid:EquipTool(tool)
print("Button 1 pressed")
end
elseif input.KeyCode == Enum.KeyCode.Two then
local tool = player.Backpack:FindFirstChild(slot2)
if tool and tool:IsA("Tool") then
humanoid:EquipTool(tool)
print("Button 2 pressed")
end
elseif input.KeyCode == Enum.KeyCode.Three then
humanoid:UnequipTools()
print("Button 3 pressed")
end
end)
When I press 1 or 2, it is supposed to switch to a tool based on the value in "Slot1" or "Slot2". It does not do this, it does not even print "Button x Pressed"
Example: Player presses 1, script should equip the tool based on the text value of Slot1
Example: Player presses 2, script should equip the tool based on the text value of Slot2
Example: Player presses 3, script should unequip all of the players tools.
Coregui is disabled.
** You are now Level 1! **