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

1 comment
I'm not sure what a "callback" is but I don't playtest solo I do a server test instead. Usually I server test with three players. All the print statements do print but the main problem is they are not giving the tool. Thanks for viewing.