TechWorks
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 282 |
|
|
| 06 Jan 2013 02:01 PM |
I made a sprinting GUI, and a script to work in all tools. I've tested it in build mode, and it works perfectly, but when I tried testing it in-game with someone else, it broke. Basically, you hit 'c' and sprint for alotted time. All of its nuances work in build mode, but not in game. It is a LocalScript.
Player = script.Parent.Parent.Parent Character = Player.Character function Sprint(Key) print(Character) if string.lower(Key) == "c" then if Character:FindFirstChild("Sprinting").Value == 1 then Character.Sprinting.Value = 0 elseif Character:FindFirstChild("Sprinting").Value == 0 and Character.Sprinting:FindFirstChild("Winded") == nil then Character.Sprinting.Value = 1 end end end
function GetMouseStuff(mouse) mouse.KeyDown:connect(Sprint) end
script.Parent.Equipped:connect(GetMouseStuff) |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 06 Jan 2013 02:04 PM |
Player = script.Parent.Parent.Parent Character = Player.Character function Sprint(Key) print(Character) if string.lower(Key) == "c" then if Character:FindFirstChild("Sprinting").Value == 1 then Character.Sprinting.Value = 0 elseif Character:FindFirstChild("Sprinting").Value == 0 and Character.Sprinting:FindFirstChild("Winded") == nil then Character.Sprinting.Value = 1 end end end
function GetMouseStuff(mouse) mouse.KeyDown:connect(Sprint) end
script.Parent.Selected:connect(GetMouseStuff) |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 06 Jan 2013 02:05 PM |
Explination: You're using a HopperBin, not a Tool, so .Equipped should be .Selected. Ex. script.Parent.Selected:connect(GetMouseStuff) --correct script.Parent.Equipped:connect(GetMouseStuff) --incorrect |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 06 Jan 2013 02:05 PM |
@hunt Selected is for Hopperbins, if she's using a Tool then she needs Equipped.
To answer your problem, add "wait()" to the top of the script. So it looks like,
wait() -- Your code here |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2013 02:07 PM |
even better, after Player = script.Parent.Parent.Parent:
Character = Player.Character or Player.CharacterAdded:wait()
¬ LuaLearners Elite/Writer |
|
|
| Report Abuse |
|
|
TechWorks
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 282 |
|
|
| 06 Jan 2013 02:08 PM |
But it's in a tool. Localscripts don't change 'Equipped' to 'Selected', do they? //First time using a LocalScript |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 06 Jan 2013 02:08 PM |
@1Topcop
She IS using a hopperbin, hence Player = script.Parent.Parent.Parent script = script Parent (1) = hopperbin Parent (2) = backpack Parent (3) = player
While using a tool... Player = script.Parent.Parent.Parent script = script Parent (1) = tool Parent (2) = character Parent (3) = workspace |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 06 Jan 2013 02:09 PM |
@TechWorks
After you paste that into a localscript, insert it into a HopperBin, and see if it works. |
|
|
| Report Abuse |
|
|
TechWorks
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 282 |
|
|
| 06 Jan 2013 02:10 PM |
@1Top
Okay, it's fixed. Thanks. Btw, a collection of pixels doesn't inherently have a specific gender. A thing to keep in mind. |
|
|
| Report Abuse |
|
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 06 Jan 2013 02:11 PM |
You're welcome.
-- I win, and (s)he never specified that it was in a tool, or a hopperbin. c: |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 06 Jan 2013 02:11 PM |
......................................__................................................ .............................,-~*`¯lllllll`*~,.......................................... .......................,-~*`lllllllllllllllllllllllllll¯`*-,.................................... ..................,-~*llllllllllllllllllllllllllllllllllllllllllll*-,.................................. ...............,-*llllllllllllllllllllllllllllllllllllllllllllllllllllll.\.......................... ....... .............;*`lllllllllllllllllllllllllll,-~*~-,llllllllllllllllllll\................................ ..............\lllllllllllllllllllllllllll/.........\;;;;llllllllllll,-`~-,......................... .. ...............\lllllllllllllllllllll,-*...........`~-~-,...(.(¯`*,`,.......................... ................\llllllllllll,-~*.....................)_-\..*`*;..).......................... .................\,-*`¯,*`)............,-~*`~................/..................... ..................|/.../.../~,......-~*,-~*`;................/.\.................. ................./.../.../.../..,-,..*~,.`*~*................*...\................. ................|.../.../.../.*`...\...........................)....)¯`~,.................. ................|./.../..../.......)......,.)`*~-,............/....|..)...`~-,............. ..............././.../...,*`-,.....`-,...*`....,---......\..../...../..|.........¯```*~-,,,, ...............(..........)`*~-,....`*`.,-~*.,-*......|.../..../.../............\........ ................*-,.......`*-,...`~,..``.,,,-*..........|.,*...,*...|..............\........ ...................*,.........`-,...)-,..............,-*`...,-*....(`-,............\....... ......................f`-,.........`-,/...*-,___,,-~*....,-*......|...`-,..........\........ my brain hurts |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2013 02:12 PM |
a collection of pixels can hold an association to a specific gender which is sufficient to assume that one is of that gender (in modern-day society's context), however.
¬ LuaLearners Elite/Writer |
|
|
| Report Abuse |
|
|
TechWorks
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 282 |
|
|
| 06 Jan 2013 02:12 PM |
@hunte Localscripts retain their position, even if their ancestry changes. At least, that's what I've noticed, so it's probably not everything. |
|
|
| Report Abuse |
|
|
TechWorks
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 282 |
|
|
| 06 Jan 2013 02:13 PM |
@doombringer
Maybe so, but said collection of pixels is not, in and of itself, a specific gender. It's gender is what's assigned to it by others' interpretations of what it represents, not by what it is. |
|
|
| Report Abuse |
|
|
hunte922
|
  |
| Joined: 28 May 2008 |
| Total Posts: 6969 |
|
|
| 06 Jan 2013 02:17 PM |
my pixels are gendered they're all ladies |
|
|
| Report Abuse |
|
|