Positing / Welding Issues

Hello There. I am DomDerpRBLX. And I am currently developing a Storm Chasing game on Roblox. And, I created a system that spawns a supercell. And I created an X part, a Z part, and a Y part and used math.random to determine where a tornado could spawn. However, I welded the parts to the supercell so when it spawns in a random position, it would stick together so we wouldnt have any issues. However, the parts don’t move… They don’t change position with the Storm. How could I fix this? Keep in mind I already tried welding. They aren’t anchored either. How could I fix this?

Can you please provide code so we can understand what your problem is and try to analyze it better, thanks.

while true do
	wait(10)
	local Storms = game.ServerStorage.Storms:GetChildren()
	local Tornadoes = game.ServerStorage.Tornadoes:GetChildren()
	local SelectedStorm = Storms[math.random(1,#Storms)]:Clone()
	local SVectors = game.Workspace.StormSpawnArea
	local TS = game:GetService("TweenService")
	
	print(SelectedStorm)
	SelectedStorm.Parent = workspace
	TS:Create(SelectedStorm,TweenInfo.new(5),{Transparency = 0}):Play()
	SelectedStorm.Position = Vector3.new(math.random(SVectors.MainPart.Position.X,SVectors.X.Position.X),math.random(SVectors.MainPart.Position.Y,SVectors.Y.Position.Y),math.random(SVectors.MainPart.Position.Z,SVectors.Z.Position.Z))
	SelectedStorm.Orientation = Vector3.new(0,math.random(-360,360),0)
	wait(math.random(5,20))
	if SelectedStorm.Name == "Supercell" then
		TS:Create(SelectedStorm.RainFog.RainFog.RainFogTex,TweenInfo.new(5),{ImageTransparency = 0.1}):Play()
	end
	wait(100)
end

Notice how it teleports the position to a random position? The parts inside of it dont move with the selected storm.

Ah, I see, you’re trying to change the position using Vector3 (SelectedStorm.Position), well you cannot do that with welds, that’ll rather break the entire weld.

What you can do as a solution and better method is to use CFrames, because they allow the parts to have freedom in their own matrix rather than the game’s Vector3, what you’re looking for to do is CFrame the storm and the welded parts will all follow it.

So it’ll be something in these lines:

SelectedStorm.CFrame= SelectedStorm.CFrame * CFrame.new() -- rest of position code inside the CFrame.new()

Note the same thing for Orientation, if you want the parts to move the same in orientation then use CFrameAngles

CFrames: CFrames | Documentation - Roblox Creator Hub

So CFrame is in general better to use instead of Vector3? I do notice it has more customisable stuff. like allowing you to look at stuff.

Yes it’s far more better than Vector3, allows more freedom and access to far more options.

One of the major impacts of CFrame is that that axis is local and based on where your part is not the world space/direction of that part, that’s what I meant by saying in their own matrix

Also that CFrame contains the Coordinate Frame as well as the LookVector.

I’ll link AxisAngle’s great resource and explanation on it: How to think about CFrames

But as a general answer to your question, yes CFrames are better.

Is there any instance you would use vector3

Can you please explain what do you mean by an instance? because I generally believe all the instances in roblox that contain a position property have CFrame.

However, GUI’s are excluded as they use Vector2 for User Interface.

Not the instance your thinking of. Im not talking about the Instance in roblox, im talking about the general word, “Instance”

Sorry, a bit confused on what you mean by general word instance.

What I can explain is that anything that has a Vector3 or a world position is capable of having its own matrix.