Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's wrong with this script?

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

✓ Accepted answer
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

2 comments

0

Thanks!

0

Anytime.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.