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: Trouble with local scripts (finding local character)

Previous Thread :: Next Thread 
brightstorm603 is not online. brightstorm603
Joined: 10 Apr 2010
Total Posts: 6807
20 Jul 2015 04:37 PM
Hiyo! I'm having a problem with a local script that I can't seem to explain. The third line of the script is as follows:

local Humanoid = game.Players.LocalPlayer.Character.Humanoid


I need to access the player's character model to adjust their walk speed. This line is copied and pasted from the ROBLOX wiki, but I get the following error message in game mode:

Players.Player1.PlayerGui.LocalScript:3: attempt to index field 'Character' (a nil value)



I have no idea what's going on, I've used this exact line of code before and it's worked fine. Does anyone have any idea what the deal might be?
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
20 Jul 2015 04:39 PM
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()

local Humanoid = Character.Humanoid
Report Abuse
brightstorm603 is not online. brightstorm603
Joined: 10 Apr 2010
Total Posts: 6807
20 Jul 2015 04:41 PM
I forgot to mention, I originally had the script in startergui. I tried putting it in starterpack as well, neither worked.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
20 Jul 2015 04:44 PM
That means nothing, unless it's not a LocalScript.
If you want persistent scripts, you should place them in PlayerScripts.
Report Abuse
brightstorm603 is not online. brightstorm603
Joined: 10 Apr 2010
Total Posts: 6807
20 Jul 2015 04:46 PM
The local script in question performs a function when the "f" key is pressed.

To use keydown, don't you put a local script in the player's starterpack or startergui?
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
20 Jul 2015 04:48 PM
Yes, does my code not work.
Report Abuse
brightstorm603 is not online. brightstorm603
Joined: 10 Apr 2010
Total Posts: 6807
20 Jul 2015 04:49 PM
I tried making the change, it also didn't work. I suppose I can try starting again from scratch, but this makes no sense.
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