So i am trying to clone a TextButton into a Frame with a UIGridLayout.

The script is located in the item that is in the workspace "Water Bottle Large". The "TextButton" is located in Replicated Storage.

The Local Script:

local ItemFrame= game.StarterGui.Inventory.MFrame.ItemFrame
local itembutton = game.ReplicatedStorage.ItemButton
local item = script.Parent.Parent.Parent.Handle

script.Parent.Parent.ProximityPrompt.Triggered:Connect(function()
	local clone = itembutton:Clone()
	clone.Parent = ItemFrame
	clone.Name = "Water Bottle Large"	
	item:Destroy()
end)

2 comments

0

I recommend checking if the event was fired. Or maybe cloning a GUI does not work on a local script.

0

I'd set the position and if it was visible