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: omg, help

Previous Thread :: Next Thread 
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 05:49 PM
localPlayer = game.Players.LocalPlayer
localCharacter = localPlayer.Character or localPlayer.CharacterAdded:wait()
mouse = localPlayer:GetMouse()
humanoid = localCharacter:WaitForChild("Humanoid")

My variables, it's in a localscript in startergui.

When my character dies, the whole script breaks which makes it seem like it's the fault of the variables. Is it?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Dec 2014 05:50 PM
Right above humanoid, add a wait() :)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 05:53 PM
localPlayer = game.Players.LocalPlayer
localCharacter = localPlayer.Character or localPlayer.CharacterAdded:wait()
mouse = localPlayer:GetMouse()
wait()
humanoid = localCharacter:WaitForChild("Humanoid")


still breaks D:
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Dec 2014 05:54 PM
Hmm, any output
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 05:54 PM
nope
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Dec 2014 05:55 PM
I don't think it's from those 4 lines but WaitForChild always seemed, well, weird for me.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 05:56 PM
The script is like 100 lines, everything works just fine as they should before I die once...
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 05:57 PM
oh and it works fine in play solo
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
29 Dec 2014 06:04 PM
well in that case, i learned the same today is that LocalPlayer does not work off of solo mode, so it all the stuff mentioning LocalPlayer that is breaking it
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 06:06 PM
well it shouldnt and it only breaks when i reset so it may be the localCharacter because I use that a lot
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
29 Dec 2014 06:06 PM
plus, usually when i grab the humanoid i use FindFirstChild, not WaitForChild
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 06:07 PM
well here I need WaitForChild and not FindFirstChild
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
29 Dec 2014 06:07 PM
The vars look like they were declared correctly. You should probably look elsewhere for where it might be breaking (Sometimes the output can be misleading!)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
29 Dec 2014 06:08 PM
its the variables.
Report Abuse
UltraTechX is not online. UltraTechX
Joined: 24 Oct 2013
Total Posts: 350
29 Dec 2014 06:11 PM
can you tell us what it says when it breaks, it looks like

error description with disconnected event or

scriptName:error
script line that caused it
script lines that lead up to it
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Dec 2014 11:06 AM
bump
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Dec 2014 01:01 PM
bumperino alabama al dente
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Dec 2014 02:51 PM
bump
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
30 Dec 2014 02:55 PM
repeat wait(1) until game.Players.LocalPlayer
local player = game.Players.LocalPlayer
local char = player.Character
local torso = char:WaitForChild('Torso')
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Dec 2014 03:07 PM
gg

it worked
hooray

I used repeat wait() in my last script but...some guy told me it was no use in startergui localscripts

whatever
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Dec 2014 03:09 PM
That doesn't make sense, it's probably the wait(1) fixing it.
Since the LocalPlayer will exist when that script is run (obviously because PlayerGui is a child of the player).

So just wait(1), no need for the repeat :)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Dec 2014 03:13 PM
Heh yeah, it works then aswell.

It's so weird, like I didn't think of adding any waiting because it's in the playergui and player is already loaded n' all :/
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Dec 2014 03:14 PM
Yeah, this shouldn't be a problem and your original script should have worked fine. I feel as if it's more Roblox's fault than yours.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
30 Dec 2014 03:16 PM
Mhm of course.
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