14:12:37.638 - ServerScriptService.Main_Script:92: attempt to index local 'player' (a nil value)
how would i make this work? The reason i ask is because i'm trying to organize the clothes within a folder thats in Assets. Then have it find the required clothes according to the team the player is on. CODE BELOW
local Storage = game:getService("ReplicatedStorage")
function Change_Clothes(char)
for _,x in next,char:GetChildren()do
if x:IsA("Hat")or x:IsA("Shirt")or x:IsA("Pants")then
x:Destroy()
end
end
local player = game.Players:GetPlayerFromCharacter(char.Parent)
Storage.Assets[player.Team].Shirt:Clone().Parent = char
Storage.Assets[player.Team].Pants:Clone().Parent = char
Storage.Assets[player.Team].Hat:Clone().Parent = char
end
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
wait(1) Change_Clothes(char)
print(player.Name.." has joined!")
end)

3 comments
I may be wrong but you're getting the players character from "Char" which is a argument inside Change_Clothes, and it doesn't seem like you passed any values to the argument "char" at all???
How would I find the player within a function?
@LightModed, he did pass the 'char' argument from the parameter in his CharacterAdded event. On line 19