Beam attachment not updating

Hey,
I’m trying to make a lightning effect with beams and attachments but the beams or attachments don’t move despite the output saying so.

image
The hierarchy (the attachments named AttachmentMain are the first and last at the top and bottom)


Video demonstration

The script (part of a larger one):

coroutine.wrap(function()
			for i = 1, 3 do
				for i, v in pairs(cloud:GetChildren()) do
					if v:IsA("Attachment") and v.Name ~= "AttachmentMain" then
						print(v.Position)
						v.WorldCFrame *= CFrame.new(math.random(-5,5), 0, math.random(-5,5))
						print(v.Position)
					end
				end
				wait(.1)
			end
			for i, v in pairs(cloud:GetChildren()) do
				if v:IsA("Beam") then
					v:Destroy()
				end
			end
		end)()

I’m absolutely stumped as I tried CFrame, WorldCFrame, Position and WorldPosition and can’t think of any other solutions.
Tell me if you need to see more of the script.

Thanks!

hi, i have tried this script with a beam attached to both attachments with this script

script.Parent.WorldCFrame += Vector3.new(math.random(-10,10),0,math.random(-10,10))

Script.Parent.WorldCFrame is basically v.WorldCFrame

let me know if it works

Thanks, but that didn’t seem to work, but somehow, just by removing the coroutine.wrap(function() line it works all of a sudden

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