Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What's wrong with this script?

Asked by 10 years ago
1while true do
2    explosion = Instance.new("Explosion")
3        explosion.BlastPressure = 10000
4        explosion.BlastRadius = 50
5        explosion.DestroyJointRadiusPercent = .3
6        explosion.Position = (math.random),(math.random),(math.random)
7            wait(math.random(1,8))
8end

I want it to generate random explosions everywhere with these traits. I need help, and was wondering if one of you guys could help.

2 answers

Log in to vote
2
Answered by 10 years ago
01local waitTime = 1 -- Every 1 second the script will repeat again. Change to what you want.
02 
03while wait() do
04    wait(waitTime)
05    local part = Instance.new("Part",game.Workspace)
06    part.Position = Vector3.new(math.random(-300,300)),(math.random(-300,300)),(math.random(-300,300))
07    part.Anchored = true
08    part.Transparency = 1
09    part.CanCollide = false
10    local Explosion = Instance.new("Explosion",part)
11    Explosion.BlastPressure = 10000
12    Explosion.BlastRadius = 50
13    Explosion.Position = part.Position
14    ExplosionType = "CratersAndDebris"
15    wait(1)
16    part:Destroy()
17    Explosion:Destroy()
18end
0
Thanks! Lightdrago 95 — 10y
0
Anytime. ObscureEntity 294 — 10y
Ad
Log in to vote
0
Answered by
ilel 0
10 years ago
1while true do
2            explosion = Instance.new("Explosion")
3            explosion.BlastPressure = 10000
4            explosion.BlastRadius = 50
5            explosion.DestroyJointRadiusPercent = .3
6        explosion.Parent  = workspace
7            explosion.Position = Vector3.new( (math.random),(math.random),(math.random))
8            wait(math.random(1,8))
9    end

Change the math.randoms to math.random(x,y) with x being the minimum number and y being maximum.

Answer this question