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 » Scripting Helpers
Home Search
 

Re: I need a random speed script, plz.

Previous Thread :: Next Thread 
ZiluRA is not online. ZiluRA
Joined: 03 Apr 2009
Total Posts: 555
14 Feb 2013 04:15 PM
I am making a map that involves zombies, one of which I would like to randomly increase its walkspeed. For this zombie moves at 20 speed, I would like it to have a 1 in like 100 chance to make its speed 40 instead of 20, then after 8 seconds it goes back to 20. I know theres math.random scripts, but they arent walkspeed based. This script I would like to be designed to work with zombies, and it just randomly happens. Can anyone make me a script that involves that, or perhaps just help me design this script. I am completely new at scripting, so I have no idea what to do. thanks
Report Abuse
shadowlego7 is not online. shadowlego7
Joined: 03 Mar 2007
Total Posts: 2278
14 Feb 2013 04:25 PM
What do you mean by making it go away after 8 seconds? Like after he spawns?

Anyway, here's the 1 in a 100 chance. You should try and learn scripting, because we don't always know what exactly you have in mind.

local a = math.random(1,100)
if a == 1 then
zombiename.Humanoid.WalkSpeed = 40
end
Report Abuse
ZiluRA is not online. ZiluRA
Joined: 03 Apr 2009
Total Posts: 555
14 Feb 2013 04:32 PM
yea thats like something I need, and I very much thank you for the help :)

what i meant was like after the chance happens where his walkspeed is increased to 40, after 8 seconds, it decreases back to 20. Then the script restarts itself.

Example
-------------------
Zombie chance script runs.
1,100 that 1 chance happens and the zombies speed is increased to 40.
8 seconds pass, zombie loses the speed boost and speed returns to 20.
the script then restarts.

Thanks for the help thus far :)
Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
14 Feb 2013 04:35 PM
local a = math.random(1,100)
if a == 1 then
zombiename.Humanoid.WalkSpeed = 40
wait(8)
zombiename.Humanoid.Walkspeed = 20
end
Report Abuse
shadowlego7 is not online. shadowlego7
Joined: 03 Mar 2007
Total Posts: 2278
14 Feb 2013 04:37 PM
Well, looping scripts typically lag the game. I think you should come up with a different solution.
Report Abuse
tweetytime is not online. tweetytime
Joined: 19 Apr 2008
Total Posts: 397
14 Feb 2013 04:39 PM

local a = math.random(1,100)
local b = math.random(1,1000)

if b == 1 then
print'Turbo Kicking in!'
end


if a == 1 then
zombiename.Humanoid.WalkSpeed = 40
wait(8)
zombiename.Humanoid.Walkspeed = 20
end

Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
14 Feb 2013 04:41 PM
Lol choor funny.

Looping scripts only lag the game if the loop is significant...

If you have a loop of: while true do wait() runfunction end
Or loops that run constantly quickly, then lag will occur.

Anything that runs every 5+ seconds should be fine.
Report Abuse
ZiluRA is not online. ZiluRA
Joined: 03 Apr 2009
Total Posts: 555
14 Feb 2013 04:42 PM
thanks for all of the help you have given me. you guys are the best :D

not sure what the local b is for, but i guess ill test it out, thanks :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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