i'm making a inventory gui whenever you click the item it finds the item based off of a boolvalue in the textbutton that has the name of the item then the script finds the name based off of the boolvalue how exactly do I do that heres my script
local player = game.Players.LocalPlayer function onButtonClicked() game.Lighting:FindFirstChild(""):Clone().Parent = player.Backpack end script.Parent.MouseButton1Down:connect(onButtonClicked)
That should work, but line 1 is useless. And make sure you replace "" with the child's name.
I would also recommend putting your objects in ServerStorage or ReplicatedStorage, not Lighting.