Rotate object welded to torso

I’ve welded a flag to the players back when they “capture” it.

It currently sits on the back of the player with the flag pole horizontal. I want it to be slightly rotated to sit at an angle across the players back. This image should explain:

rotate-flag

The red flag is the real flag in-game, the blue dotted line is where I want it to be.

And here is the code that is welding the flag to the player:

local function PickupFlag(player: Player, flagObject)
	FlagCarriers[player] = flagObject
	flagObject.AtSpawn = false
	flagObject.PickedUp = true
	
	local torso
	assert(player.Character)
	assert(player.Character.Humanoid)

	if player.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
		torso = player.Character:FindFirstChild('Torso')
	else
		torso = player.Character:FindFirstChild('UpperTorso')
	end

	local flagPole = flagObject.FlagPole :: Part
	local flagBanner = flagObject.FlagBanner
	
	flagPole.Anchored = false
	flagBanner.Anchored = false
	flagPole.CanCollide = false
	flagBanner.CanCollide = false
	
	local weld = Instance.new('Weld', flagPole) :: Weld
	weld.Name = 'PlayerFlagWeld'
	weld.Part0 = flagPole
	weld.Part1 = torso
	weld.C0 = CFrame.new(0, 0, -1)
end

I tried all sorts of versions of the weld.C0 CFrame assignment but the docs seem to imply that it only changes/sets position. So I’m a bit confused as to what I need to do.

Any help much appreciated!

Not really experienced with this, but couldn’t you do,

weld.C0 = CFrame.new(0, 0, -1) * CFrame.Angles(x,y,z) 
1 Like

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