Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help waiting for character to be loaded?

Asked by
StoIid 364 Moderation Voter
8 years ago

I need a more efficient way for the code to wait for the players character to be loaded.

wait(3)--To make sure the character and other stuff is loaded. I do not know how to make it wait for your character to be loaded
bin = script.Parent
Me = game.Players.LocalPlayer -- I changed it to LocalPlayer instead of your regular one
me = Me
name = "Sky Dragon's Drive"
Backpack = bin.Parent
Player1 = Backpack.Parent
Player = Player1.Character
Hum = Player.Humanoid

These are my variables and Line 9 and up seems to be giving me trouble. If i don't have the Wait, the server says the Player value is nil.

1 answer

Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
8 years ago

All you have to do is tell it to keep waiting until there's a character.

bin = script.Parent
Me = game.Players.LocalPlayer
me = Me
name = "Sky Dragon's Drive"
Backpack = bin.Parent
Player1 = Backpack.Parent
repeat wait() until Player1.Character -- Wait until there's a character.
Player = Player1.Character
Hum = Player.Humanoid
0
I am going to assume that this works because I cannot get on studio right now, but thank you! StoIid 364 — 8y
0
No problem. Pyrondon 2089 — 8y
Ad

Answer this question