Help locking a rig in a specific orientation

Basically I am making the part of my boat where the player grabs the steering wheel and I want to be able to lock the players rig with the arms extended outwards. I know how to stop the player from moving, but not sure what to do for this part.

local armRotation = function(character)
	local leftUpperArm = character.LeftUpperArm
	local rightUpperArm = character.RightUpperArm
	--rotate arms
	print("rotating")
	leftUpperArm.Orientation = leftUpperArm.Orientation + Vector3.new(45, 0, 0)
	rightUpperArm.Orientation = rightUpperArm.Orientation + Vector3.new(45, 0, 0)
end
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait()
	local char = player.Character
	task.wait(3)
	armRotation(char)
end)

I tried using this script to test changing character arm rotation, but nothing seemed to occur.

1 Like

Don’t manually set the rotation of a rigs part, rather manipulate it’s motor6d using CFrame.

2 Likes
function rotate(m6d: Motor6D, focus, offset1, offset2)
	local cfr1 = m6d.Part0.CFrame
	cfr1 = cfr1:ToWorldSpace(offset1)
	local cfr = m6d.Part0.CFrame:Inverse() * CFrame.lookAt(cfr1.Position, focus)
	cfr = cfr:ToWorldSpace(offset2)
	local t = game.TweenService:Create(m6d, TweenInfo.new(0.2, Enum.EasingStyle.Circular, Enum.EasingDirection.Out), {C0 = cfr})
	t:Play()
end

local armRotation = function(character)
	local leftUpperArm = character.LeftUpperArm
	local rightUpperArm = character.RightUpperArm
	--rotate arms
	print("rotating")
	local offset = CFrame.Angles(math.rad(90), 0, 0)
	repeat
		local pos1 = game.Workspace.Part.Position --change it to pos you want to rotate right arm
		local pos2 = game.Workspace.Part.Position --change it to pos you want to rotate left arm
		rotate(rightUpperArm.RightShoulder, pos1, CFrame.new(1, 0, 0), offset)
		rotate(leftUpperArm.LeftShoulder, pos2, CFrame.new(-1, 0, 0), offset)
		wait()
	until character.Humanoid.Health == 0
end

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait()
	local char = player.Character
	task.wait(3)
	armRotation(char)
end)

it will not work on other parts of body.

1 Like

Though I would update this thread. Made this script a couple days ago, basically I used an animation that was the orientation I wanted the character rig and I paused the orientation to lock the player. Then it was just a matter of moving the humanoid root part to exactly where I wanted it and unlocking the player when the jump off the part.

--initialize
local holdPart = script.Parent
local debounceTouch = false
local debounceEndTouch = false
local isOnWheel = false
local aTrack = nil

--load animation
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://18237442922"

holdPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if not debounceTouch then
			debounceTouch = true
			debounceEndTouch = true
			local character = hit.Parent
			local animator = character.Humanoid.Animator
			aTrack = animator:LoadAnimation(animation)
			
			--make the player not be able to move
			character.Humanoid.WalkSpeed = 0
			
			--orient the player toward the wheel
			isOnWheel = true
			print("Jumped on wheel")
			
			--load the animation
			repeat task.wait() until aTrack.Length > 0
		
			aTrack:Play()
			aTrack:AdjustSpeed(0)
			
			character.HumanoidRootPart.Position = Vector3.new(holdPart.Position.X,character.HumanoidRootPart.Position.Y,holdPart.Position.Z)
			character.HumanoidRootPart.Orientation = holdPart.Orientation
			
			task.wait(.2)
			debounceTouch = false
			debounceEndTouch = false
		end
	end
end)

holdPart.TouchEnded:Connect(function(hit)
	if isOnWheel and not debounceEndTouch then
		print("Jumped off wheel")
		local character = hit.Parent
		character.Humanoid.WalkSpeed = 16 --default value
		aTrack:Stop()
		isOnWheel = false
		task.wait(1)
	end
end)

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