Still have questions? Join our Discord server and get real time help.
Log in to vote

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

Asked by 5 months ago
Edited 5 months ago
local Cup = workspace.Dispenser.Box2
local Handle = workspace.Dispenser:WaitForChild('Handle') -- "Handle" assumed to already be in Workspace
local player = game.Players.LocalPlayer.Character

print('LOADED CUP')
    for i = 1,10 do
        Handle.Transparency = Handle.Transparency - 0.1
    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.

Also if you are going to comment, "Try WaitForChild" it either doesn't work or I'm putting it in the wrong place. MustangHeart 26 — 5mo
You get the backpack from the LocalPlayer, not their Character lol. And ServerStorage is inaccessible by clients, move your objects to ReplicatedStorage. User#19524 2 — 5mo
Thank you so much dude! Please post your comment as an answer so I can give you the best answer! MustangHeart 26 — 5mo
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 2 — 5mo

Answer this question