Rotating a welded Cylinder

How can I make the cylinder flat, and not how it’s like now?

Here are some methods I tried, but they all failed.

Method 1:

newHeal.CFrame = character.HumanoidRootPart.CFrame * CFrame.Angles(0,90,-90)

Method 2:

newHeal.Orientation = Vector3.new(0, 90, -90)

Both methods failed.

This is the code:

local newHeal = healCircle:Clone()
Debris:AddItem(newHeal,3)
newHeal.Parent = game.Workspace
newHeal.CFrame = character.HumanoidRootPart.CFrame
local weld = Instance.new("Weld",newHeal)
weld.Part0 = character.HumanoidRootPart
weld.Part1 = newHeal

1 Like

You do realize that CFrame math is done is radians, not degrees? 90 radians is 5156.62 degrees.

Yeah as such,

math.rad(90)=math.pi/2
1 Like

CFrame.Angles takes in angles in radians, not degrees. Use math.rad() to convert your degrees into angles. Also, if you’re using weld instead of weld constraints, you’re going to want to specify an offset for your weld:

Here is a working version, no extra code needed:

local Debris = game:GetService("Debris")

local healCircle = Instance.new("Part")
healCircle.Shape = Enum.PartType.Cylinder
healCircle.CanCollide = false
healCircle.Massless = true

local size = 10
healCircle.Size = Vector3.new(1,size,size)

-- welds two parts together in their current relative orientation
local function createWeld(part0, part1, weldType, offset)
    local weld = Instance.new(weldType or "Weld")
    
    offset = offset or CFrame.new()
    
    weld.Part0 = part0
    weld.Part1 = part1
    weld.C0 = part0.CFrame:inverse() * part1.CFrame * offset
    weld.Parent = part0
    
    return weld
end


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local newHeal = healCircle:Clone()
		Debris:AddItem(newHeal,3)
		newHeal.Parent = workspace
		newHeal.CFrame = character.HumanoidRootPart.CFrame * CFrame.Angles(0,0,math.rad(90))
		
		createWeld(newHeal, character.HumanoidRootPart, "Weld")
		
	end)
end)
4 Likes

This worked, however the character wont adjust to the rotation.

I’m confused what your trying to achieve?

Could you expand on what its meant to do?

When the character spawns in the cylinder, it’s supposed to be flat. Like the newest gif I uploaded. However, when you spawn it, the character walks facing the same direction you were facing before you spawned it in. Once it gets removed, then the direction of the character adjusts.

I threw the code you just uploaded into studio, and it works perfectly for me. I know this isn’t ideal, but maybe it has something to do with your animation or package. Try using a motor6d weld maybe.

https://gyazo.com/066256d760fe3f3169921cde3fd246ef

Never mind, I just needed to set Massless to true, however how does change the ability to rotate the character?

Massless was already true in the code you provided though? That was gonna be my first recommendation but it was already enabled in the code
With massless enabled, it doesn’t contribute to the total mass or inertia to any welded part that has mass

Edit:I was using royaltoe’s code, not yours, I just realized