What do you want to achieve? Keep it simple and clear!
Im trying to create a script where when you change teams it will give you a gear.
What is the issue? Include screenshots / videos if possible!
The issue is it wont give the item when you change the team.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked on scriptinghelpers.com to see anything about this and found nothing.
local TeamsService = game:GetService("Teams")
for _, team in pairs(TeamsService:GetTeams()) do
if team.Name == "Soldier" or team.Name == "Raider" then
local clone = game.ServerStorage.AKM:Clone()
clone.Parent = player.Backpack
elseif team.Name == "Civilian" then
if player.Backpack:FindFirstChild("AKM") then
You probably want to use player:GetPropertyChangedSignal("Team") instead of doing a PlayerAdded event to each team.
local Players = game:GetService("Players")
if player.Team.Name == "Soldier" or player.Team.Name == "Raider" then
-- Do stuff