I have a simple coloring system that changes the player's color once they respawn. However, I'd need to wait until they finish respawning and then apply the colors, else they'll revert to normal.
I've already tried this, however it doesnt seem to be working (line 4);
repeat wait() until char.Humanoid.Health == 100
Here's my full script;
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
char.Humanoid.Died:Connect(function()
repeat wait() until char.Humanoid.Health == 100
local onecolor1 = char.Wing1
local onecolor2 = char.Wing2
-- wing colors above
local twocolor1 = char.Body
local twocolor2 = char.Antenna1
local twocolor3 = char.Antenna2
-- body colors above
local randomcolor1 = BrickColor.Random()
onecolor1.BrickColor = randomcolor1
onecolor2.BrickColor = randomcolor1
-- coloring the wings
local randomcolor2 = BrickColor.Random()
twocolor1.BrickColor = randomcolor2
twocolor2.BrickColor = randomcolor2
twocolor3.BrickColor = randomcolor2
-- coloring the body
end)
end)

1 comment
CharacterAdded event is fire when the Character spawn or respawn. https://developer.roblox.com/api-reference/event/Player/CharacterAdded