Hi! I am making a hotbar system. I already have an inventory system which you can put the tools in the hotbar. When you equip the tools in the inventory it works, but when you press on the slot in the hotbar it doesnt work even though they use the same script? Please help
Local Script:
local button = script.Parent
local plr = game.Players.LocalPlayer
local selected = script.Parent:WaitForChild("Selected")
local equipped = script.Parent.Parent.Parent.Frame.Handler.Equipped
local location = script.Parent.Parent.Parent.Frame.Handler.Location
button.MouseButton1Click:Connect(function()
if plr and plr.Character then
local character = plr.Character
if equipped.Value == nil or equipped.Value ~= selected.Value then
character.Humanoid:UnequipTools()
print("Tool")
if location.Value == plr.Backpack then
print("HOT BAR1:".. button:FindFirstChild("Selected").Value.Name)
character:WaitForChild("Humanoid"):EquipTool(selected.Value)
equipped.Value = selected.Value
print("Equipping Tool")
end
else
character.Humanoid:UnequipTools()
equipped.Value = nil
print("Unequipping tool")
end
character.Humanoid:UnequipTools()
end
end)

4 comments
I edited it because it wasn't formatted correctly
all the prints are firing btw it's just the equip tool not working correctly
what is selected ?
Where is the local script located? Try placing the local script in StarterPlayerScripts if you haven't already