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: Script help

Previous Thread :: Next Thread 
voItages is not online. voItages
Joined: 02 Nov 2013
Total Posts: 677
29 May 2015 05:21 PM
plr = game.Players.LocalPlayer
char = plr.Character

It says char is a nil value in the developer console in-game



=volty=
Report Abuse
voItages is not online. voItages
Joined: 02 Nov 2013
Total Posts: 677
29 May 2015 05:24 PM
b1



=volty=
Report Abuse
gergy008 is not online. gergy008
Joined: 16 Mar 2008
Total Posts: 7039
29 May 2015 05:32 PM
plr = game.Players.LocalPlayer
char = plr:WaitForChild("Character")
Report Abuse
OKevinO is online. OKevinO
Joined: 05 May 2010
Total Posts: 1036
29 May 2015 05:33 PM
Either because you are using a Global script, since you cant call a LocalPlayer with a global script. Or because your second line "char" is trying to define your character before your character is even created (spawned in).

Solutions:
-Add a wait time before the "char" variable so it waits long enough for your character to spawn.
-Create a "CharacterAdded" function to trigger the function whenever your player is spawned, and then define your variable in that function.
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
29 May 2015 05:57 PM
local player = game.Players.LocalPlayer
local char = player.Character

if char then
--code
end
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
29 May 2015 05:58 PM
plr = game.Players.LocalPlayer
char = plr.Character or plr.CharacterAdded:wait()
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