Trying to make effects go out, instead they go into the same location

Hi, sorry for the bulky title, let me explain:
I’m trying to create a combat effect in which all of the effects (little extended spheres) go in different ways outwards, however, whenever prompted, my result is as such:

Update for anyone trying to fix this problem : use CFrame to world space. this is an old thread i found and decided to put the answer for anyone in need.


Here’s a snippet of the effect’s code,

	for i = 1, b do --//b is random number of times
		coroutine.resume(coroutine.create(function()
			local effect = Instance.new("Part")
			effect.CanCollide = false
			effect.Size = Vector3.new(1,1,1)
			effect.Anchored = true
			effect.Parent = torso
			effect.Transparency = .5
			effect.Color = Color3.fromRGB(220, 220, 220)
			effect.Size = Vector3.new(1.69, 1, 0.97)
			effect.Name = "Blow"
			effect.CFrame = torso.CFrame
			effect.Material = Enum.Material.SmoothPlastic
			local p = Instance.new("SpecialMesh")
			p.MeshType = Enum.MeshType.Sphere
			p.Parent = effect
			p.Parent = effect 
			local ending = {}
			ending.Size = Vector3.new(4.33, 1, 0.97)
			ending.CFrame = effect.CFrame*CFrame.new(0,0,5)
			effect.Orientation = Vector3.new(math.random(0,200), math.random(0,200), math.random(0,200)) --//random direction
			ending.Orientation = effect.Orientation
			local tweeninfo = TweenInfo.new(.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
			local b = tweenservice:Create(effect, tweeninfo, ending)
			b:Play()
		end))
	end

Any solutions?

1 Like

CFrame.new(0,0,-x) should move them forward(along the lookVector) x units. But you’re currently doing this before you set the orientation, so they’re all going to end up in the same place.

2 Likes

Thank you for that.
Do you know any way to do the CFraming more convienently?
Currently, I intended for it to move the way it was orientated, but it doesn’t do that.

1 Like

I’d just do something like

local rng = Random.new();
local cframegoal = cframe * CFrame.Angles(0,rng:NextNumber()*math.pi*2,0) * CFrame.new(0,0,-distance)
2 Likes