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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: My running script needs a quick easy simple modification

Previous Thread :: Next Thread 
y1p is not online. 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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
26 Mar 2016 02:55 PM
http://wiki.roblox.com/index.php?title=Random_numbers
Report Abuse
dave2011 is not online. 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 is not online. 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 is not online. 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 is not online. y1p
Joined: 05 May 2013
Total Posts: 350
26 Mar 2016 03:14 PM
bump
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
26 Mar 2016 03:33 PM
uis
Report Abuse
TimeTicks is not online. 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 is not online. Thedagz
Joined: 10 Mar 2012
Total Posts: 798
26 Mar 2016 03:49 PM
Use UserinputService not Keydown
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