Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I need help with finding an item based off of the name of a boolvalue?

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)

1 answer

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.

3 comments

0

Line 1 does have a purpose...

0

so it look like game.Lighting:FindFirstChild(script.Parent.Item.Name):Clone().Parent = player.Backpack?

0

You may also want to make the cloned object a variable, just to clean up the code.

This discussion is preserved as it was. New answers, comments, and votes are closed.