I'm using a script that makes use of BodyForce so the character can jump higher, by checking the masses of every part of the character and using the total weight of all the parts. However, sometimes the character loads too early and the script isn't able to detect every part of the character, resulting in a smaller BodyForce and thus a smaller jump. How can I wait until every part of the character's loaded before using the script?
✓ ANSWER ACCEPTED
How can I check to see if the whole character's loaded?
1 answer
✓ Accepted answer
CharacterAdded
You can really just use the CharacterAdded event to make sure that the character is fully loaded just as NotsoPenguin has stated in the comments:
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(s)
--do body force action here
print("Character Loaded!")
end)
end)
Or even if you are using a local-script, you can do something as the following:
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:wait()
print("Character Loaded!")
--do body force action here
Now, if you are waiting for hats to be loaded in or so, you can also add:
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(s)
repeat until s.ChildAdded:wait() == "Hat"
print("Character Loaded!")
end)
end)
Useful Links
http://wiki.roblox.com/index.php?title=API:Class/Player/CharacterAdded http://wiki.roblox.com/index.php?title=User:JulienDethurens/Essays/Wait_method
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
If I were you I would just be lazy and do a wait(3) or something at the top, although there's is very likely a better method.
I'm sure there's a better method. Don't wanna do an arbitrary wait though since I wanna get people in the game as soon as the thing loads. Not to mention some players might load longer than 3 seconds which would mess the whole thing up.
Player.CharacterAdded:wait() should wait until the character is fully loaded? But this will only work when the player spawns.