EquippedVal.Changed:connect(function()for b,V in pairs(UiFrame:GetChildren())do if V:IsA("\073\109\097\103\101\066\117\116\116\111\110")then V.BorderSizePixel=1 end end if EquippedVal.Value then local b=UiFrame:FindFirstChild(EquippedVal.Value.Name)if b then b.BorderSizePixel=4 end end end)for b,V in pairs(UiFrame:GetChildren())do if V:IsA("\073\109\097\103\101\066\117\116\116\111\110")then V.MouseButton1Click:Connect(function()local b=SlotsFolder:FindFirstChild(V.Name)if b then if EquippedVal.Value==b then EquippedVal.Value=nil else EquippedVal.Value=b end end end)end end game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)

EquippedVal.Changed:connect(function()
	for i,v in pairs(UiFrame:GetChildren()) do
		if v:IsA('ImageButton') then
			v.BorderSizePixel = 1
		end
	end
	if EquippedVal.Value then
		local imageButton = UiFrame:FindFirstChild(EquippedVal.Value.Name)
		if imageButton then
			imageButton.BorderSizePixel = 4
		end
	end
end)

for i,v in pairs(UiFrame:GetChildren()) do
	if v:IsA("ImageButton") then
		v.MouseButton1Click:Connect(function()
			local slotRequested = SlotsFolder:FindFirstChild(v.Name)
				if slotRequested then -- if there is such a slot
					-- if they're requesting the same slot
					if EquippedVal.Value == slotRequested then 
						EquippedVal.Value = nil -- unequip the tool
					else
						EquippedVal.Value = slotRequested -- equip the tool
					end
				end
		end)
	end
end

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

