Particle Rotation Matching Part/Parent Rotation

I want the rotation of a particle to match the rotation of the part it is parented to.

I couldn’t find anything on the dev hub pertaining to my issue, so I tried scripting my own solution (making the rotation parameter equal to the orientation variables etc…), but nothing seems to work.

--This is a simpler version of one of the solutions I tried, because most of the others are spaghetti code and barely readable or deleted

function particleToPartOrientation()
	local children = script.Parent:GetChildren()
	local main = script.Parent
	local orientX = main.Orientation.X

	for _, v in ipairs(children) do
		if v:IsA("ParticleEmitter") then
			v.Rotation = NumberRange.new(orientX,orientX)
		end
	end
end

while task.wait() do
	particleToPartOrientation()
end

Another thing, the emitters use velocity perpendicular, as I found this works best/ is closest to my desired outcome.

I got this effect with these properties for the ParticleEmitter:

EmissionDirection = Front
Orientation = VelocityPerpendicular
Speed = .01

Then i used a script to constantly correct the Rotation of the ParticleEmitter to the Z-axis of the part.

Note that if the part is only going to be anchored and not move at all, it’s better off to set the Rotation of the ParticleEmitter to the part’s Z-axis in the property tab, instead of having a script looping unnecessarily.

local part = script.Parent
local emitter = part.ParticleEmitter

while wait() do
	local z = part.Orientation.Z
	emitter.Rotation = NumberRange.new(z, z)
end
2 Likes

Thank you, this worked for me.

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