Still have questions? Join our Discord server and get real time help.
0

# [SOLVED] Backpack is not a valid member of model?

Edited 10 months ago
workspace.Dispenser.Gui.SurfaceGui.Frame.TextButton1.MouseButton1Down:Connect(function()
local Cup = workspace.Dispenser.Box2
local Handle = workspace.Dispenser:WaitForChild('Handle') -- "Handle" assumed to already be in Workspace
local player = game.Players.LocalPlayer.Character

for i = 1,10 do
Handle.Transparency = Handle.Transparency - 0.1
wait(0.1)
end
workspace.Sound:Play()
wait(3)
Handle.Transparency = 1
local NewCup = game.ServerStorage.Coffee:Clone()
NewCup.Handle.CFrame = Cup.CFrame
NewCup.Parent = player.Backpack
print (NewCup.Parent)
end) -- Rewritten


When I try to run this code via LocalScript, all it prints in the output when I try to clone the item to the player's backpack is, "Backpack is not a valid member of model". I've had this problem in the past and have no idea why it happens. Also the LocalScript is placed inside StarterCharacterScripts, too.

0
Also if you are going to comment, "Try WaitForChild" it either doesn't work or I'm putting it in the wrong place. MustangHeart 30 — 10mo
0
You get the backpack from the LocalPlayer, not their Character lol. And ServerStorage is inaccessible by clients, move your objects to ReplicatedStorage. User#19524 106 — 10mo
0
Thank you so much dude! Please post your comment as an answer so I can give you the best answer! MustangHeart 30 — 10mo
0
it's fine. Edit your title so it contains [SOLVED], it marks the question as answered and let's others know the problem has been solved. User#19524 106 — 10mo