|
| 14 Aug 2016 07:22 AM |
I got my script:
function onTouched(hit) local luck = math.random(1,5) if luck == 1 then hit.Parent.Humanoid.Walkspeed = 50 script.Parent:Destroy() wait(2) hit.Parent.Humanoid.Walkspeed = 16 elseif luck == 2 then hit.Parent.Humanoid.Walkspeed = 5 wait(5) hit.Parent.Humanoid.Walkspeed = 16 elseif luck == 3 then hit.Parent.Humanoid.PlatformStand = true wait(3) hit.Parent.Humanoid.PlatformStand = false elseif luck == 4 then hit.Parent.Humanoid.Walkspeed = 100 wait(3) hit.Parent.Humanoid.Walkspeed = 5 wait(2) hit.Parent.Humanoid.Walkspeed = 16 elseif luck == 5 then local a = Instance.new("Smoke") a.Parent = hit.Parent.Humanoid wait(5) a:Destroy() end script.Parent:Destroy() end
script.Parent.Touched:connect(onTouched)
I got this is in a brick, but, I always get the same luck. Is there anyway to get a random luck?
|
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 14 Aug 2016 07:25 AM |
put this at the very top: math.randomseed(tick())
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 07:28 AM |
math.randomseed(tick())
function onTouched(hit) local luck = math.random(1,5) if luck == 1 then hit.Parent.Humanoid.Walkspeed = 50 script.Parent:Destroy() wait(2) hit.Parent.Humanoid.Walkspeed = 16 elseif luck == 2 then hit.Parent.Humanoid.Walkspeed = 5 wait(5) hit.Parent.Humanoid.Walkspeed = 16 elseif luck == 3 then hit.Parent.Humanoid.PlatformStand = true wait(3) hit.Parent.Humanoid.PlatformStand = false elseif luck == 4 then hit.Parent.Humanoid.Walkspeed = 100 wait(3) hit.Parent.Humanoid.Walkspeed = 5 wait(2) hit.Parent.Humanoid.Walkspeed = 16 elseif luck == 5 then local a = Instance.new("Smoke") a.Parent = hit.Parent.Humanoid wait(5) a:Destroy() end script.Parent:Destroy() end
script.Parent.Touched:connect(onTouched)
I get the same thing every time..
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 08:25 AM |
| math.randomseed(math.random(tick())) |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 14 Aug 2016 08:39 AM |
No that's dumb, math.randomseed(tick()) is just fine for seeding it. What you suggested is worse.
@op have you tried it in online mode and it does the same thing?
|
|
|
| Report Abuse |
|
|
| |
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 14 Aug 2016 08:43 AM |
You should put a debounce in like
local db = false function touch(whatever) if db==false then db = true --stuff wait(1) db = false end end
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 08:44 AM |
I don't know how to use debounce..
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2016 08:52 AM |
"No that's dumb, math.randomseed(tick()) is just fine for seeding it. What you suggested is worse."
when I used math.randomseed(tick()), i ran it like 20 times and got 1 every time so you're wrong |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 14 Aug 2016 08:59 AM |
youtube.com/watch?v=VxeEr3wUonQ
|
|
|
| Report Abuse |
|
|