Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Prioxis 673 Moderation Voter
10 years ago

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

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

0
Line 1 does have a purpose... Shawnyg 4330 — 10y
0
so it look like game.Lighting:FindFirstChild(script.Parent.Item.Name):Clone().Parent = player.Backpack? Prioxis 673 — 10y
0
You may also want to make the cloned object a variable, just to clean up the code. Perci1 4988 — 10y
Ad

Answer this question