Explosion problems

I want the part to explode when clicked.
Here’s my script inside the ClickDetector:

	if script.Parent["IsExploding?"].Value == true then
		local explosion = Instance.new("Explosion")
		explosion.BlastRadius = 60
		explosion.ExplosionType = Enum.ExplosionType.NoCraters -- damages terrain
		explosion.Position = Vector3.new(0, 10, 0)
		explosion.Parent = script.Parent
	end

The error is that it doesn’t explode.

2 Likes

Set the Position to the Part’s Position:

explosion.Position = script.Parent.Position

oh… right. I’ll test that out, thanks!

It still doesn’t explode, I don’t know what’s wrong.

script.Parent:FindFirstChild("IsExploding?").Changed:Connect(function()
	if script.Parent:FindFirstChild("IsExploding?").Value == true then
		local explosion = Instance.new("Explosion")
		explosion.BlastRadius = 60
		explosion.ExplosionType = Enum.ExplosionType.NoCraters -- damages terrain
		explosion.Position = Part.Position --Put your part's position here
		explosion.Parent = script.Parent
	end
end) 

no offense, but you just sent me the same exact script. also, it cant be when the explosion is changed, it has to be when its clicked.

You didn’t send me the entire script, how was I supposed to know. What is the “IsExploding?” value you have?

if you mean what type of value then it is a boolean value. also… i did. Edit: Nevermind, I figured it out.

The script I send and the script you have listed are two different things.

Yours:

Mine:

One looks for the value to change and then it fires the function, the other just does a one-time check to see if it is true. If you have not tested my script then you should give it a try because it should work. If not please provide more details as to what errors you might be receiving and where things are located at in the explorer tab.

It’s… fine. I already solved it. [character limit]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.