y1p
|
  |
| Joined: 05 May 2013 |
| Total Posts: 350 |
|
|
| 26 Mar 2016 02:52 PM |
mouse = game.Players.LocalPlayer:GetMouse()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 8
function run(key) if key == "0" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = x end end
function stopRunning(key) if key == "0" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 8 end end
repeat wait() until game.Players.LocalPlayer mouse.KeyDown:connect(run)
mouse.KeyUp:connect(stopRunning)
Basically instead of "x" it needs to be a random number between 14-24, and the number updates every 0.5 seconds. |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2016 02:55 PM |
| http://wiki.roblox.com/index.php?title=Random_numbers |
|
|
| Report Abuse |
|
|
dave2011
|
  |
| Joined: 02 Oct 2010 |
| Total Posts: 10581 |
|
|
| 26 Mar 2016 02:55 PM |
while wait(.5) do x=math.random(14,24) end
|
|
|
| Report Abuse |
|
|
y1p
|
  |
| Joined: 05 May 2013 |
| Total Posts: 350 |
|
|
| 26 Mar 2016 03:00 PM |
| i know how to use (math.random,)) but i dont know how to put a while true do statement in the script without messing it up when its supposed to stop running. |
|
|
| Report Abuse |
|
|
y1p
|
  |
| Joined: 05 May 2013 |
| Total Posts: 350 |
|
|
| 26 Mar 2016 03:01 PM |
mouse = game.Players.LocalPlayer:GetMouse()
function run(key) while wait(0.5) do x=math.random(14,24) end if key == "x" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 32 end end
function stopRunning(key) if key == "0" then game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 end end
repeat wait() until game.Players.LocalPlayer mouse.KeyDown:connect(run)
mouse.KeyUp:connect(stopRunning)
doesnt work |
|
|
| Report Abuse |
|
|
y1p
|
  |
| Joined: 05 May 2013 |
| Total Posts: 350 |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 26 Mar 2016 03:40 PM |
local uis = game:GetService("UserInputService") local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local human = char:WaitForChild("Humanoid") local continue = false
uis.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.Zero and not continue then continue = true while continue do human.WalkSpeed = math.random(14,24) wait(0.5) end end end)
uis.InputEnded:connect(function(input) if input.KeyCode == Enum.KeyCode.Zero then continue = false human.WalkSpeed = 8 end end) |
|
|
| Report Abuse |
|
|
Thedagz
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 798 |
|
|
| 26 Mar 2016 03:49 PM |
| Use UserinputService not Keydown |
|
|
| Report Abuse |
|
|