Tracktion
|
  |
| Joined: 06 Jun 2013 |
| Total Posts: 1893 |
|
|
| 07 Jul 2017 12:54 PM |
Why is it some scripts don't work unless you use a wait() but in studio they work perfect without it.
Almighty 全能 |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 07 Jul 2017 12:55 PM |
1. you don't need a wait()
and the reason is because studio runs faster |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 07 Jul 2017 12:56 PM |
| a good example would be using a character variable in a local script local Player = game.Players.LocalPlayer local Character = Player.Character -- this may work but probably not in a real good so you can do local Character = nil while Player.Character == nil or ##################arent == nil do wit() end Character = Player.Character or local Character = Player.CharacterAdded:wait() |
|
|
| Report Abuse |
|
|
Tracktion
|
  |
| Joined: 06 Jun 2013 |
| Total Posts: 1893 |
|
|
| 07 Jul 2017 12:57 PM |
What can I use instead WaitForChildren?
Almighty 全能 |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 07 Jul 2017 12:57 PM |
| you can but for things like characters you can't |
|
|
| Report Abuse |
|
|
Tracktion
|
  |
| Joined: 06 Jun 2013 |
| Total Posts: 1893 |
|
|
| 07 Jul 2017 12:57 PM |
Ah alright thank you
Almighty 全能 |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2017 12:57 PM |
WaitForChild("Part", 5)
or
repeat wait() until workspace:FindFirstChild("Part") |
|
|
| Report Abuse |
|
|
|
| 07 Jul 2017 12:58 PM |
| the Character is a property of Player so cannot WaitForChild() because it's not a child. |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
| |
|
|
| 07 Jul 2017 01:04 PM |
repeat wait() until player.Character
|
|
|
| Report Abuse |
|
|