So currently it equips the torch when you press the gui button, but I don’t know how to make it unequip it after you click it again. Can someone help please?
local player = game.Players.LocalPlayer
local tool = player:WaitForChild(“Backpack”):WaitForChild(“Torch”)
local player = game.Players.LocalPlayer
local tool = player:WaitForChild(“Backpack”):WaitForChild(“Torch”)
script.Parent.MouseButton1Down:connect(function()
local wep = player.Character:FindFirstChild(tool)
if player.Character then
if wep == nil then
player.Character.Humanoid:EquipTool(tool)
elseif wep ~= nil then
wep.Parent = player.Backpack
end
end
end)
It seems to be fine? Are there any errors in the output?
local player = game.Players.LocalPlayer
local tool = player:WaitForChild("Backpack"):WaitForChild("Torch")
local equipped = false
script.Parent.MouseButton1Click:connect(function()
equipped = not equipped
if equipped then
player.Character.Humanoid:EquipTool(tool)
else
player.Character.Humanoid:UnequipTools()
end
end)