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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|