So I am making a Local Script Located in StarterGUI (Not in a ScreenGUI) that changes player parts color into their team color once they join.
They are colored when they join, problem is whenever someone is killed, the code doesn’t run anymore. Meaning color is back to default
Neither ‘PlayerAdded’ or ‘CharacterAdded’ prints. The only piece of code running is the last for loop, so the code only works once
function cellshade(Character)
end
function OnPlayerJoin(e: Player)
cellshade(e.Character)
end
game.Players.PlayerAdded:Connect(function(player)
print('Player Added !')
player.CharacterAdded:Connect(function(char)
print('Character Added !')
for _, e in ipairs(game.Players:GetPlayers()) do
if e == game.Players.LocalPlayer then
continue
else
OnPlayerJoin(e)
end
end
end)
OnPlayerJoin(player)
end)
for _, e in ipairs(game.Players:GetPlayers()) do
if e == game.Players.LocalPlayer then
continue
else
OnPlayerJoin(e)
end
end
Oh wait it worked for player removing, from what i saw from devhub it says because the player is created before the script connects/player is created before the script is even created.
For team it was probably because they made sure the scripts loaded before you joined
Actually a server client remote event isnt a bad idea, ive done that a few times with character appearance loaded and playeradded. Give it a try and show me your code if you still need help with the server client remote event!