This code is for an item pickup system, and I only want players on a particular team to be able to pick it up. However, I get an error when the code runs.
player = game.Players.LocalPlayer boostPack = script.Parent plunger = script.Parent.Parent.Plunger needle = script.Parent.Parent.Needle serum = script.Parent.Parent.Serum local function onPartTouch(otherPart) local partParent = otherPart.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") if humanoid then if player.Team == "Doctor" then local boosts = humanoid.Parent.Boosts boosts.Value = boosts.Value + 1 boostPack:Destroy() plunger:Destroy() needle:Destroy() serum:Destroy() end end end boostPack.Touched:Connect(onPartTouch)
A player's Team is not a string, it is a reference to the actual team instance. Change line 15 to:
if player.Team == game.Teams.Doctor then