Welding part does not work

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve an effect where a part I have stays in the air and rotates.
  2. What is the issue? Include screenshots / videos if possible!
    Whenever I weld the to the other parts MainPart (which is anchored) the script refuses to work. If I unanchor all the welded parts they fall out of the sky. Please help.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried searching other posts related to #welds and #scripting, but have not found one that solves my problem yet.

Here is the local script,

local CollectionService = game:GetService("CollectionService")

local RingCapsules = CollectionService:GetTagged("RingCapsule")
local ShieldCapsules = CollectionService:GetTagged("ShieldCapsule")


task.spawn(function()
	while true do
		task.wait()
		for i, Capsule_Trigger in pairs(RingCapsules) do
			local PrimaryPart = Capsule_Trigger.Parent.PrimaryPart
			for i = 1, math.huge do
				task.wait(0.1)
				PrimaryPart.Orientation = Vector3.new(0, i, 0)
			end
		end
	end
end)

I’m trying to make a model (a capsule), that stays in the air and rotates. Just by rotating the PrimaryPart which has other parts in the model welded to it. I tried setting massless to true on the welded parts, but that did not work. Unanchoring the welded parts will just result in them falling out of the sky.

1 Like

your code will only rotate one capsule in RingCapsules. As for the welded parts, use weld constraint, check if it is enabled, and set to their respective parts, because unanchoring them should not result in them falling, it would stick to the primary part

2 Likes

parent the welds, that should solve it

2 Likes

May I ask what the difference between Welds and WeldConstraints are? (Sorry for the late response)

I know this is a stupid question, but who do I parent it to?

Weld Tutorial 0.01

Doesn’t matter, they are still going to be welded together afterall

1 Like

Also why do you have two weld constraints? You only need one to weld it

There are two parts though. (had to type longer because of text limit). I welded both of them to the capsule. And then I only kept the capsule anchored and set anchored to false on the welded parts. And turned on massless.

Nevermind! I used :GetPivot() and a number variable.

Here’s the code:

local CollectionService = game:GetService("CollectionService")

local RingCapsules = CollectionService:GetTagged("RingCapsule")
local ShieldCapsules = CollectionService:GetTagged("ShieldCapsule")


task.spawn(function()
	for i, Capsule_Trigger in pairs(RingCapsules) do
		local RingCapsuleModel = Capsule_Trigger.Parent
		local defaultAngle = 0
		
		while true do
			task.wait(0.1)
			defaultAngle = defaultAngle + 0.1
			RingCapsuleModel:PivotTo(RingCapsuleModel:GetPivot() * CFrame.Angles(0, math.rad(defaultAngle), 0))
		end
	end
end)

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