local player = game.Players.LocalPlayer
print(player.Parent.Name)
local FirstAidKit = game.ReplicatedStorage["First Aid Kit"]
local Doc = game.Teams.Doctors
print("a")
if player.Team == Doc then
print("B")
FirstAidKit:Clone().Parent = player.Backpack
end
This code is supposed to give the player a kit if the player is in team doc but it’s saying that backpack is not a valid member of player.
You should wait for the player to load.
add an WaitForChild
local player = game.Players.LocalPlayer
print(player.Parent.Name)
local FirstAidKit = game.ReplicatedStorage["First Aid Kit"]
local Doc = game.Teams.Doctors
print("a")
if player.Team == Doc then
print("B")
FirstAidKit:Clone().Parent = player:WaitForChild("Backpack")
end
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
if Player.Team == game.Teams.Doctors then
game.ReplicatedStorage["First Aid Kit"]:Clone().Parent = Player.Backpack
end
end)
end)