-- Decompiled with the Synapse X Luau decompiler.


while true do
	wait();
	if game:IsLoaded() and game:GetService("Players").LocalPlayer.Character then
		break;
	end;
end;
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false);
local l__LocalPlayer__1 = game:GetService("Players").LocalPlayer;
local l__Character__2 = l__LocalPlayer__1.Character;
local u1 = {
	Zero = 0,
	One = 1, 
	Two = 2, 
	Three = 3, 
	Four = 4, 
	Five = 5, 
	Six = 6, 
	Seven = 7, 
	Eight = 8, 
	Nine = 9
};
function ConvertKey(p1)
	local v3, v4, v5 = pairs(u1);
	while true do
		wait();
		local v6, v7 = v3(v4, v5);
		if v6 then

		else
			break;
		end;
		v5 = v6;
		if p1.KeyCode == Enum.KeyCode[v6] then
			return v7;
		end;	
	end;
	if false == false then

	else
		return;
	end;
	return false;
end;
local u2 = nil;
local hum = l__Character__2:WaitForChild("Humanoid");
function Equip(p2, p3)
	if p3 == true then

	else
		u2 = p2;
		hum:EquipTool(p2);
		script.Equip:Play();
		return;
	end;
	hum:UnequipTools();
	script.Equip:Play();
end;
local u4 = {};
function AddTemplate(p4)
	local v8 = 0;
	local v9, v10, v11 = pairs(script.Parent.Parent.Parent.MainFrame.Hotbar:GetChildren());
	while true do
		wait();
		local v12, v13 = v9(v10, v11);
		if v12 then

		else
			break;
		end;
		v11 = v12;
		if v13:IsA("TextButton") then
			v13:Destroy();
		end;	
	end;
	u4 = {};
	local v14, v15, v16 = pairs(l__LocalPlayer__1.Backpack:GetChildren());
	while true do
		wait();
		local v17, v18 = v14(v15, v16);
		if v17 then

		else
			break;
		end;
		v16 = v17;
		u2 = v18
		table.insert(u4, v18);
		local v19 = script.Template:Clone();
		v19.Name = v18.Name;
		v19.Parent = script.Parent.Parent.Parent.MainFrame.Hotbar;
		v19.Number_slot.Text = v17;
		v8 = v17;
		if v18.TextureId ~= "" then
			v19.Tool_Data.Text = "";
			v19.Texture_tool.Image = v18.TextureId;
		else
			v19.Tool_Data.Text = v18.Name;
		end;
		v19.Visible = true;
		v19.Tool_Obj.Value = v18;	
	end;
	if p4 then
		table.insert(u4, p4);
		local v20 = script.Template:Clone();
		v20.Name = p4.Name;
		v20.Parent = script.Parent.Parent.Parent.MainFrame.Hotbar;
		v20.Number_slot.Text = v8 + 1;
		if p4.TextureId ~= "" then
			v20.Tool_Data.Text = "";
			v20.Texture_tool.Image = p4.TextureId;
		else
			v20.Tool_Data.Text = p4.Name;
		end;
		v20.Visible = true;
		v20.Tool_Obj.Value = p4;
		v20.IsEquip.Value = true;
		v20.Number_slot.TextColor3 = Color3.fromRGB(0, 170, 255);
	end;
	local v21, v22, v23 = pairs(script.Parent.Parent.Parent.MainFrame.Hotbar:GetChildren());
	while true do
		wait();
		local v24, v25 = v21(v22, v23);	
		if v24 then

		else
			break;
		end;
		v23 = v24;
		if v25:IsA("TextButton") then
			v25.MouseButton1Down:Connect(function()
				if u2 ~= v25.Tool_Obj.Value then
					local v26, v27, v28 = pairs(script.Parent.Parent.Parent.MainFrame.Hotbar:GetChildren());
					while true do
						wait();
						local v29, v30 = v26(v27, v28);
						if v29 then

						else
							break;
						end;
						if v30:IsA("BoolValue") then
							if v30.Tool_Obj.Value ~= v25.Tool_Obj.Value then
								v30.Value = false;
							end;
						end;
						if v30:IsA("TextLabel") then
							if v30 ~= v25.Number_slot then
								v30.TextColor3 = Color3.fromRGB(255, 255, 255);
							end;
						end;					
					end;
				end;
				v25.IsEquip.Value = not v25.IsEquip.Value;
				if v25.IsEquip.Value then
					v25.Number_slot.TextColor3 = Color3.fromRGB(0, 255, 0);
				else
					v25.Number_slot.TextColor3 = Color3.fromRGB(255, 255, 255);
				end;
				if v25.IsEquip.Value == false then
					Equip(v25.Tool_Obj.Value);
				else
					Equip(v25.Tool_Obj.Value, false);
				end
			end);
		end;	
	end;
end;
game:GetService("UserInputService").InputBegan:Connect(function(p5, p6)
	if not p6 and p5.UserInputType == Enum.UserInputType.Keyboard and ConvertKey(p5) then
		local v31 = ConvertKey(p5);
		for v32, v33 in pairs(script.Parent.Parent.Parent.MainFrame.Hotbar:GetDescendants()) do
			if v33:IsA("TextLabel") and v33.Text == tostring(v31) then
				if u2 ~= v33.Parent.Tool_Obj.Value then
					local v34, v35, v36 = pairs(script.Parent.Parent.Parent.MainFrame.Hotbar:GetDescendants());
					while true do
						wait();
						local v37, v38 = v34(v35, v36);
						if not v37 then
							break;
						end;
						if v38:IsA("BoolValue") and v38.Parent.Tool_Obj.Value ~= v33.Parent.Tool_Obj.Value then
							v38.Value = false;
						end;
						if v38:IsA("TextLabel") and v38 ~= v33 then
							v38.TextColor3 = Color3.fromRGB(255, 255, 255);
						end;					
					end;
				end;
				v33.Parent.IsEquip.Value = not v33.Parent.IsEquip.Value;
				if v33.Parent.IsEquip.Value then
					v33.TextColor3 = Color3.fromRGB(0, 255, 0);
				else
					v33.TextColor3 = Color3.fromRGB(255, 255, 255);
				end;
				Equip(v33.Parent.Tool_Obj.Value, not v33.Parent.IsEquip.Value);
			end;
		end;
	end;
end);
l__LocalPlayer__1.Backpack.ChildAdded:Connect(function(p7)
	local v39 = false;
	if p7:IsA("Tool") then
		for v40, v41 in pairs(u4) do
			if v41 == p7 then
				v39 = true;
				break;
			end;
		end;
		if v39 == false then
			AddTemplate();
			u4 = {};
		end;
	end;
end);
l__LocalPlayer__1.Backpack.ChildRemoved:Connect(function(p8)
	if p8.Parent ~= l__Character__2 then
		AddTemplate();
	end;
end);
l__Character__2.ChildAdded:Connect(function(p9)
	local v42 = false;
	if p9:IsA("Tool") then
		for v43, v44 in pairs(u4) do
			if v44 == p9 then
				v42 = true;
				break;
			end;
		end;
		if v42 == false then
			AddTemplate(p9);
		end;
	end;
end);
l__Character__2.ChildRemoved:Connect(function(p10)
	if p10.Parent ~= l__LocalPlayer__1.Backpack then
		AddTemplate();
		u2 = nil;
	end;
end);
AddTemplate();
