Explosion isnt going to right position

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    On click of a certain part an explosion is supposed to happen at that part

  2. What is the issue? Include screenshots / videos if possible!
    It always goes to 0, 0, 0 instead

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I did, but I didn’t understand any solutions

My code:

local part = script.Parent.Parent

part.ClickDetector.MouseClick:Connect(function()
	local explosion = Instance.new("Explosion")
	explosion.DestroyJointRadiusPercent = 0
	explosion.BlastPressure = 0
	explosion.Parent = part
	explosion.CFrame = part.CFrame
end)

sorry if this has an obvious answer, i never used explosions before

1 Like

Try changing the Position property of the explosion to the position of the part.

explosion.Position = part.Position

You might also find this useful if you are still unsure on how to resolve the issue:
Explosion - Documentation

Hope this helps :slight_smile:

3 Likes

Hi there,

Assuming part is a ClickDetector, ClickDetectors don’t have a Vector3 Position in the 3D space, it’s best you slightly modify your code to declare the ClickDetector and the physical BasePart separately.

local click = script.Parent.Parent -- Location of the ClickDetector
local part = click.Parent -- Part where the explosion will happen

click.MouseClick:Connect(function()
	local explosion = Instance.new("Explosion")
	explosion.DestroyJointRadiusPercent = 0
	explosion.BlastPressure = 0
	explosion.Parent = part
	explosion.Position = part.Position
end)

Additionally as @1Keeth mentioned above. Explosions don’t have CFrames and you should consider using it’s Position property instead.

1 Like

Thanks this worked i didnt realize that i put CFrame and Vector3.new() at first but not position

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