You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to make when the Gui name equals to item name that stored in replicated storage it will clone the item from replicated storage to player backpack
-
What is the issue? Include screenshots / videos if possible!
found an error in the line 14
its says:
```Players.EducatedPilot04.PlayerGui.Inventory.IventoryPages.ScrollingFrame.Cube.LocalScript:14: attempt to index nil with ‘Backpack’`` -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried to use bool value to check if item is equipped in player backpack
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this is the code:
script.Parent.MouseButton1Click:Connect(function(player)
print("ui clicked")
local toys = game.ReplicatedStorage.Toys:GetChildren()
print("getting item")
for i , v in pairs(toys)do
if script.Parent.Name == v.Name and script.Parent.Equipped.Value == false then
print("item loaded")
local clone = v:Clone()
v.Parent = player.Backpack
script.Parent.Equipped.Value = true
print("item success cloned :)))")
end
end
end)
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.