Simple way to make fire or smoke effect direction always go up

When a vehicle has a fire or smoke effect, it can be annoying if the vehicle is overturned that the fire or smoke effect will go sideways or upside down.

One way to make it always go up would be to make an attachment parent, then when the fire or smoke is enabled, keep checking and adjusting the orientation of the attachment.

I wouldn’t use this for a continuous fire because it would loop forever but for a temporary crash effect this could be used.

If anyone has a better idea that wouldn’t involve a potentially endless loop, please post your ideas.

Anyway, here is how I did it:

image

The very simple script:

local attachment = script.Parent.Parent
local fire = script.Parent

fire:GetPropertyChangedSignal("Enabled"):Connect(function()
	while fire.Enabled do
		print('set orientation...')
		attachment.WorldOrientation = Vector3.new(0,0,0)
		task.wait(.25)
	end	

end)

If used for a temporary effect the fire will either be disabled(which stops the loop) or destroyed (which stops the loop).

I would probably do this using a RunService:HeartBeat event and connect it to that.

Yeah I thought about that but I didn’t want it to use that much processing time, so I just chose 1/4 second.

An event like runservice won’t use that much processing time - and will probably be better than running a while loop (which I try to avoid like the plague).

I use quite a few runservice events in my experience to control stuff like this and have no problem with latency or processing.

1 Like

Suggest you create a connection that is removed once the fire.Enabled is false:

local attachment = script.Parent.Parent
local fire = script.Parent
local connection

fire:GetPropertyChangedSignal("Enabled"):Connect(function()
   
    if fire.Enabled then
        connection = RunService.Heartbeat:connect(function()
            attachment.WorldOrientation = Vector3.new(0,0,0)
        end)
    else
        connection:Disconnect()
    end
end)
1 Like

I was wanting to base it on the orientation but you can’t use GetPropertyChangedSignal with cframes or anything based on physics changes. If you could do that you could make it only connect and update if the orientation changes.

It works great, this vehicle is burning upside down:

2 Likes

Why not use a non scripted method?
Put an attachment at the center of the car.
Attach a Part to it using a BallSocketConstraint, but put the Attachment in the part a couple studs above the Part so it acts like a Pendulum.
Put your fire or smoke effect in the Part and whatever direction the vehicle sits the fire will point up.

Or another thing would be to use ParticleEmitters. Set the Speed to 0, but set the Acceleration to (0, 2 (or whatever looks best) ,0). This allows the Particles to accelerate upwards in the world axis, not the Part axis.

2 Likes