The goal is to clone to models containing Packages, into the player based on a players team. **EDIT:**I added a changed function, but I get the errer that changed is not a member?
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character ~= nil and Player.TeamColor ~= BrickColor.new("White")
local AwareModel = game.ReplicatedStorage.Aware
local SoldierModel = game.ReplicatedStorage.Soldier
function GiveParts(Model)
for _, Object in pairs(Model:GetChildren()) do
Object:Clone().Parent = Player.Character
end
end
function onChanged(TeamColor)
if Player.TeamColor == BrickColor.new("Crimson") then
GiveParts(AwareModel)
elseif Player.TeamColor == BrickColor.new("Medium blue") then --Easier for me to have them seperate
GiveParts(SoldierModel)
elseif Player.TeamColor == BrickColor.new("Pearl") then --Easier for me to have them seperate
GiveParts(SoldierModel)
end
end
Player.TeamColor.Changed:connect(onChanged)
Thanks!

12 comments
Its not cloning into the players character, not errors tho
Apologies. I overlooked something. BrickColors (TeamColor in this instance) can't be compared with a string. I've rectified this issue - If it doesn't work, then the player's TeamColor is being changed after the script is ran. If that's the case, then use of .Changed may be needed.
Oh yeah... i did the same, My bad
Still now working at all, still no errors :(
The issue then is that the player's TeamColor is edited after this script is ran. I've edited the code again to add to the line I use 'repeat' - This edit prevents the rest of the script from running until the player's TeamColor changes from the default "White". I've tested the above and it does work.
It isnt working for me, any idea why?
Are you sure that you have the right TeamColors? Are you sure that the two models you're cloning from are in ReplicatedStorage? Sometimes LocalScripts don't throw their errors to the output - Try using it in a normal script (In STUDIO), and testing it through studio; looking at the output for any errors (such as things not existing, etc). (Remember to change back to a LocalScript afterwards).
i get 11:29:50.652 - Workspace.Script:2: attempt to index local 'Player' (a nil value)
It works :D
Btw, idk if this is irrelivent is it possible to change the players character model, everytime players changes teams
Yes, it is. You'd just need to delete the old stuff you added and add the new stuff - Just use the .Changed event to do something when the player's TeamColor property changes.
edited it in but i think its wrong?