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?

2 comments

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.

0

Works perfect! Thanks!