Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 30 Dec 2015 02:58 PM |
A script I have in PlayerStarterScripts works perfectly fine, until the Player dies.
When the Player respawns, the script does not function and I get the error: "Players.Player.PlayerScripts.MyScript:98: attempt to index a nil value"
On line 98 is the following: if Character:FindFirstChild("Right Leg").Position.y > yVariable then
Why am I getting this error? |
|
|
| Report Abuse |
|
|
Selvanis
|
  |
| Joined: 14 Dec 2014 |
| Total Posts: 15 |
|
|
| 30 Dec 2015 03:00 PM |
When your script is located in PlayerStarterScripts it will not reset. So it'll keep running with the old data.
If you want the script to reset when you die you'll have to put it in your Starterpack or PlayerGui. |
|
|
| Report Abuse |
|
|
Craftero
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 30 Dec 2015 03:40 PM |
After further investigation, it seems the script doesn't run at all after the Player dies.
Are you sure it's efficent to place a script inside StarterPack? For some reason, roblox won't allow me to copy and paste the script into it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Dec 2015 04:43 PM |
| u need to wait until the character loads |
|
|
| Report Abuse |
|
|