|
| 22 Oct 2012 07:14 AM |
| I'm trying to edit this gun to have it's tool GripPos move up and down when you walk. Does anyone know if such a function exists, if so what would it look like? |
|
|
| Report Abuse |
|
|
|
| 22 Oct 2012 07:28 AM |
script.Parent.Humanoid.Running:connect(function(speed) if speed > 0 then print("Yes.") end end)
http://www.roblox.com/CeaselessSouls-Admin-Commands-Gui-based-item?id=92856199 -- Take one and enjoy! Read the description, has a lot of information. |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Oct 2012 02:05 AM |
Wait, it doesn't work because the script can't find the player ( In backpack ) So if I did script.Parent.Parent it would find a player.. But the wrong one. I'd have to go all the way to workspace and make it find the children, but I'm not sure how to do that. And I don't think it would work. |
|
|
| Report Abuse |
|
|
Monkey727
|
  |
| Joined: 12 Jan 2009 |
| Total Posts: 969 |
|
|
| 24 Oct 2012 02:22 AM |
Player = script.Parent.Parent Character = Player.Character
? |
|
|
| Report Abuse |
|
|
Rico2572
|
  |
| Joined: 18 Sep 2011 |
| Total Posts: 482 |
|
| |
|
Azarth
|
  |
| Joined: 17 Aug 2012 |
| Total Posts: 2760 |
|
| |
|
|
| 24 Oct 2012 05:51 AM |
Well, if you are using a localscript in the backpack, just change it around like this:
local player = game.Players.LocalPlayer while (not player.Character and not player.Character:FindFirstChild("Humanoid")) do wait() end
player.Character.Humanoid.Running:connect(function(speed) if speed > 0 then print("Yes.") end end) |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 24 Oct 2012 07:06 AM |
Normally you'd want to loop it,
local player = game.Players.LocalPlayer while (not player.Character and not player.Character:FindFirstChild("Humanoid")) do wait() end
player.Character.Humanoid.Running:connect(function(speed) if while speed > 0 do print("running") wait() end end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
| |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 24 Oct 2012 05:47 PM |
| You know those moments... when you just do something without thinking? But obviously meant precisely. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2012 05:52 PM |
yeah, i see what you mean
-sips tea- |
|
|
| Report Abuse |
|
|
Razghul
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 3626 |
|
|
| 24 Oct 2012 05:57 PM |
yoyopotatoe,
>H&K Leader doesn't know this.
> I do.
>mindeffed |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2012 06:02 PM |
hehe, what if he dies? It will error and break. Try this:
player = game.Players.LocalPlayer function waitForChar () repeat wait() until player.Character return player.Character end while true do local char = waitForChar() print(char.Name .. " Is Alive and Well! Or so I Beleave...") end |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2012 06:10 PM |
Are these functions meant for Local Scripts, or regular? It doesn't seem to be working.
Output on both versions: 16:09:51 - Players.Player1.Backpack.AKS-74u.LocalScript:9: unexpected symbol near 'while' |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2012 06:14 PM |
| Thats what we where LOL'ing about. Mine shouldent be doing that, my script does not have a while on line 9. Also, it should be in local scripts. Please post what my script is doing. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2012 06:46 PM |
| It's all in the same Local script. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2012 07:05 PM |
You could probably put this into the tool:
person = script.Parent.Parent.Parent human = person.Humanoid if human.WalkSpeed > 0 then INSERT REST OF SCRIPT STUFF HERE end
Now let me tell you what that script is supposed to do. Line 1: Assign variable "person" to the script's 'great grandparent' which in this case is the character. Line 2: Assign variable "human" to person's Humanoid. Line 3: If the person's walkspeed is above 0, then... Line 4+: This is where you put the script to make the gun move up and down. Line 5: end the if statement. I'm not sure if this will work, I'm just going by what I 'think' I know. Hope it helps though. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 24 Oct 2012 10:04 PM |
| Remove the "if" beside the "while". |
|
|
| Report Abuse |
|
|
|
| 25 Oct 2012 05:25 PM |
I took out if and the question mark and this happened >
15:24:19 - Character is not a valid member of Backpack |
|
|
| Report Abuse |
|
|
vat21s
|
  |
| Joined: 07 Jun 2010 |
| Total Posts: 2508 |
|
| |
|
|
| 25 Oct 2012 08:46 PM |
| It works but it spams the output, lol. I'm going to test it with some other stuff |
|
|
| Report Abuse |
|
|