I'm trying to make a script that whenever a player joins, it would loop the players and see if they are on Team1 or Team2. Then give the appropriate weapon to it. The script is a Module Script.
The problem is it does not assign it a Tool even though it has no errors, I've tried print debugging and it exactly locates to where it assigns the weapon.
All I need to know is why this is not working, not asking for anything other than that.
Thanks for viewing this!
function module:AssignTeamWeapons() local players = game.Players:GetPlayers() if #players == 1 then return nil end for i,v in pairs(players) do print("Looping through player"..v.Name) if v.Team == game.Teams.Team1 then local clone = game.ServerStorage.TeamWeapons.Pistol:Clone() clone.Parent = v:WaitForChild("Backpack") print("Gave Pistol to Survivor") elseif v.Team == game.Teams.Team2 then local clone = game.ServerStorage.TeamWeapons.ZombieTool:Clone() clone.Parent = v:WaitForChild("Backpack") print("Gave ZombieTool to Zombie") end end end
Do you ever callback that function with a server script?
Nvm found ur problem
"if #player == 1 then return nil end"
most likely ur testing this out solo