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

Why doesnt "While not" loop work? [Solved]

Asked by 9 years ago

20:36:51.736 - BodyGyro is not a valid member of Part 20:36:51.736 - Script 'Players.Player1.Backpack.Working Camera', Line 7

I insert the bodygyro when a player is added. So why doesn't it wait? Here's line 7

while not character.HumanoidRootPart.BodyGyro do wait() end

Simple loop, so why doesnt it work?

1 answer

Log in to vote
0
Answered by 9 years ago

I think the reason it says that is because BodyGyro hasn't loaded yet.

Use the term :WaitForChild() to load it

So :WaitForChild("BodyGyro") would wait for it to load before letting the script run without it.

0
It gives me this 20:48:27.575 - WaitForChild called on an Instance that is not in a DataModel. 20:48:27.575 - Script 'Players.Player1.Backpack.Working Camera', Line 6 Orlando777 315 — 9y
0
Have you tried replacing the old script with character.HumanoidRootPart:WaitForChild("BodyGyro") SpazzMan502 133 — 9y
0
Yes. Orlando777 315 — 9y
Ad

Answer this question