Scrolling frame leaves the Frame when I activate ClipsDescendants

Hey everyone I’m currently working on an InventorySystem and I first my Equip Frame which is located in the Scrolling Frame didn’t appear so I activated ClipsDescendants in the ScrollingFrame function and it got visible but when I scroll down it gets weird(only when I activate ClipsDescendants)
before:


after:

Pls let me know how I can let those things on

This happens because the EquipFrame is parented inside the ScrollingFrame. Normally, ScrollingFrames will not display the items parented to it if it goes outside the ScrollingFrame itself. Enabling the ClipDescendants property will disable this behaviour and make the equip frame visible, but the items inside the inventory will also be visible even if it goes outside the ScrollingFrame. What you could do is make a separate frame for the equip frame, outside the ScrollingFrame, then disable ClipDescendants in the ScrollingFrame.

1 Like

well I understand what u mean and I tried this method before and yes it’s the better way tbh but the only thing that held me away from doing this method was that I got a small issue cuz the EquipFrame was before in the Scrolling Frame and now it has the same spot as the scrolling frame(In the InventoryGui) and now it says in the error thing ,ServerScriptService.InventoryScript:24: attempt to index nil with ‘Clone’" and ye It’s just because I changed the Position I believe it’s easy like pretty easy but I didn’T find any variables with EquipFrame.Do u might help me with this one I think it’s easy I got 2 small scripts:(Second one has the error with clone)

local InventoryEvent = game.ReplicatedStorage.Remotes.InventoryEvent
local itemFrame = script.Parent:FindFirstChild("ItemsFrame")

InventoryEvent.OnClientEvent:Connect(function(ItemName, Value)
	if Value == true then

		local ItemButton = script.Parent.ItemsFrame.ItemButton:Clone()
		ItemButton.Visible = true
		ItemButton.Name = ItemName
		ItemButton.Text = ItemName
		ItemButton.Parent = itemFrame

		local equipButton = script.Parent.EquipFrame["EquipButton"]

		ItemButton.MouseButton1Click:Connect(function()
			script.Parent.EquipFrame.Title.Text = ItemName
			script.Parent.EquipFrame.Title.Visible = true
			equipButton.Visible = true
		end)
	end

end)




local inventoryEvent = game.ReplicatedStorage.Remotes.InventoryEvent

game.Players.PlayerAdded:Connect(function(player)

	local inventory = player:WaitForChild("Inventory")

	local inventoryFrame = player.PlayerGui:WaitForChild("InventoryGui").InventoryFrame.ItemsFrame:GetChildren()

	inventory.ChildAdded:Connect(function(Item)
		inventoryEvent:FireClient(player, Item.Name, true)
	end)
end)

inventoryEvent.OnServerEvent:Connect(function(player, ItemName, Value, button)

	if Value == false then
		local SelectedItem = player.Inventory:FindFirstChild(ItemName)
		local backpack = player.Backpack:GetChildren()
		local stuff = player.Character:GetChildren()

		if #backpack == 0 and not player.Character:FindFirstChildWhichIsA("Tool") then
			button.Text = "Unequip"
			button.BackgroundColor3 = Color3.new(255,0,0)
			SelectedItem:Clone().Parent = player.Backpack
		else
			for i,v in ipairs(backpack) do
				button.Text = "Equip"
				button.BackgroundColor3 = Color3.new(0,255,0)
				v:Destroy()
			end
			for i, v in ipairs(stuff) do
				if v:IsA("Tool") then
					button.Text = "Equip"
					button.BackgroundColor3 = Color3.new(0,255,0)
					v:Destroy()
				end
			end
		end
	end
end)

Hello there!

I believe that your code probably some mistakes or maybe another factor might be because of the system itself or a Roblox bug that you could report to Roblox.

According to the code that you have provided:

SelectedItem:Clone().Parent = player.Backpack

Make sure that the value/existing objects are within the backpack itself! If so, please provide more details about your code and the instances itself.

You could probably do:

for i, v in pairs(Selecteditems) do:
       if i == nil then --Informs about the non-existance of the object/instances
          warn("RETURING NIL due to nil of objects")
          return false
        else
            --Proceed With code
end

This code essentially informs you about the errors and returns false when there is an stderr message within the output command line.
This may be a solution to your problem but it may be unclear due to insufficient information/detail to your problem. Hope this helps!

1 Like

Ty for the response um so basically the only Issue why I can’t equip my Items and why the Error came there is because I changed the Position of the EquipFrame from the ScrollingFrame to the InventoryGui:
Roblox(52)
So idk