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

'Backpack is not a valid member of Player' help me please?

Asked by 6 years ago

Hello !, I have a problem in a script, what I want is that when the player joins the Team a weapon appears automatically, but I get an error saying the following: 'Backpack is not a valid member of Player'.

This is the 'Script':

print("hola")
local Teams = game:GetService("Teams")

local team = Instance.new("Team", Teams)
team.AutoAssignable = true

print(team.Parent, team.TeamColor)

local tool = game.ReplicatedStorage.Pistola
tool:Clone().Parent = team

local function armas(plr)
    for i,v in pairs(team:GetChildren())do
        print(v)
        local Tools = v:Clone()
        Tools.Parent = plr.Backpack
        print(plr)
    end
end

local function onPlayerJoinedTeam(player)
    print(player.Name, "joined the team")
    armas(game.Players.LocalPlayer)
end

team.PlayerAdded:Connect(onPlayerJoinedTeam)

By the way I'm using a normal Script located in 'Workspace'.

I hope you help me ... Thank you!.

0
Are you using a local script or a regular script. And is FE on or off? Jexpler 63 — 6y
0
Script Regular. ¿FE? xmaanzach 28 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

plr:WaitForChild("Backpack")

0
I forgot that, thank you! xmaanzach 28 — 6y
Ad

Answer this question