generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: StarterScript not working when a Player re-spawns?

Previous Thread :: Next Thread 
Craftero is not online. 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 is not online. 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 is not online. 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
tootoo123456 is not online. tootoo123456
Joined: 23 Apr 2010
Total Posts: 310
30 Dec 2015 04:42 PM
just drag it into it
Report Abuse
SnowyKirby is not online. SnowyKirby
Joined: 15 Jan 2013
Total Posts: 68009
30 Dec 2015 04:43 PM
u need to wait until the character loads
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image