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

LocalScript in Player cant see Backpack?

Asked by 6 years ago

Pretty much the title. Just trying to clone a tool and this is the error I get in the output.

00:01:59.034 - Backpack is not a valid member of Player

This is a LocalScript in the PlayerScripts.

local players = game:GetService("Players")
local rep = game:GetService("ReplicatedStorage")

local player = players.LocalPlayer
local clonee = rep:WaitForChild("GCL")
local back = player.Backpack

clonee.OnClientEvent:Connect(function()
    local gc = rep.Guns("Scar-H"):Clone()
    gc.parent = back
end)

I dont see how a script in the player can't see the Backpack? Any help, i'm missing something?

1
add :WaitForChild("Backpack") or you could have added a wait(2) in the beginning of the script. The classes don't load right away when a player joins the game, so adding a :WaitForChild would be good or a wait() in the beginning of the script. liteImpulse 47 — 6y
0
Works perfect! Thanks! CrispyBrix 113 — 6y

Answer this question