local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local toolone = game.ReplicatedStorage.Tools:WaitForChild("M4-A1")
local tooltwo = game.ReplicatedStorage.Tools:WaitForChild("Geist17")
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
--rest of the code
local equipped = "one"
game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.One then
if equipped ~= "one" then
equipped = "one"
humanoid:UnequipTools()
humanoid:EquipTool(toolone)
end
elseif key.KeyCode == Enum.KeyCode.Two then
if equipped ~= "two" then
equipped = "two"
humanoid:UnequipTools()
humanoid:EquipTool(tooltwo)
end
end
end)
It’s probably best to put it in StarterCharacterScripts, and set character to script.Parent, so it can work after a player dies.
But other than that, I think it should work.
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")
local toolone = game.ReplicatedStorage.Tools:WaitForChild("M4-A1")
local tooltwo = game.ReplicatedStorage.Tools:WaitForChild("Geist17")
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
--rest of the code
local equipped = "one"
game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.One then
if equipped ~= "one" then
equipped = "one"
humanoid:UnequipTools()
humanoid:EquipTool(toolone)
end
elseif key.KeyCode == Enum.KeyCode.Two then
if equipped ~= "two" then
equipped = "two"
humanoid:UnequipTools()
humanoid:EquipTool(tooltwo)
end
end
end)
local player = game.Players.LocalPlayer
local Character = script.Parent
local humanoid = Character:WaitForChild("Humanoid")
local toolone = game.ReplicatedStorage.Tools:WaitForChild("M4-A1")
local tooltwo = game.ReplicatedStorage.Tools:WaitForChild("Geist17")
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
--rest of the code
local equipped = "one"
game:GetService("UserInputService").InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.One then
if equipped ~= "one" then
equipped = "one"
humanoid:UnequipTools()
humanoid:EquipTool(toolone)
end
elseif key.KeyCode == Enum.KeyCode.Two then
if equipped ~= "two" then
equipped = "two"
humanoid:UnequipTools()
humanoid:EquipTool(tooltwo)
end
end
end)
That’s because the first one has a viewmodel with animations.
There are various ways to do this, but I recommend looking up a tutorial. (Tools in first person don’t show any body parts)
Edit: I’m happy to help with the viewmodel if you need any, but I won’t make very large amounts of it. If you do want help from me, you should probably contact me in a DM rather than this topic.