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
while true do
    explosion = Instance.new("Explosion")
        explosion.BlastPressure = 10000
        explosion.BlastRadius = 50
        explosion.DestroyJointRadiusPercent = .3
        explosion.Position = (math.random),(math.random),(math.random)
            wait(math.random(1,8))
end

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
local waitTime = 1 -- Every 1 second the script will repeat again. Change to what you want.

while wait() do
    wait(waitTime)
    local part = Instance.new("Part",game.Workspace)
    part.Position = Vector3.new(math.random(-300,300)),(math.random(-300,300)),(math.random(-300,300))
    part.Anchored = true
    part.Transparency = 1
    part.CanCollide = false
    local Explosion = Instance.new("Explosion",part)
    Explosion.BlastPressure = 10000 
    Explosion.BlastRadius = 50 
    Explosion.Position = part.Position
    ExplosionType = "CratersAndDebris"
    wait(1)
    part:Destroy()
    Explosion:Destroy()
end
0
Thanks! Lightdrago 95 — 10y
0
Anytime. ObscureEntity 294 — 10y
Ad
Log in to vote
0
Answered by
ilel 0
10 years ago
while true do
            explosion = Instance.new("Explosion")
            explosion.BlastPressure = 10000
            explosion.BlastRadius = 50
            explosion.DestroyJointRadiusPercent = .3
        explosion.Parent  = workspace
            explosion.Position = Vector3.new( (math.random),(math.random),(math.random))
            wait(math.random(1,8))
    end

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

Answer this question