Disable animation for specific Motor6D

I’m making it so when a player holds the Z key the character will point towards the mouse locations. Now this works great until you start playing animations.

  1. What do you want to achieve? Disable animations on a specific Motor6D

  2. What is the issue? Cannot figure out how?

  3. What solutions have you tried so far? Looked on dev hub, google, scripting helpers, and other sketchy forums

Here’s a video… (Sorry for trash quality I used the ingame recorder)

robloxapp-20220609-0325304_Trim.wmv (900.7 KB)

Heres my script

--In local Script--

local character = game.Players.LocalPlayer.Character
local RootPart = character:WaitForChild("HumanoidRootPart")
local rightShoulder = character:FindFirstChild("Right Shoulder", true)
local shC0 = rightShoulder.C0
local shYOff = shC0.Y

local mouse = game.Players.LocalPlayer:GetMouse()

local uis = game:GetService("UserInputService")

local CFNew, CFAng, asin = CFrame.new, CFrame.Angles, math.asin

game:GetService("RunService").RenderStepped:Connect(function()	
	if uis:IsKeyDown(Enum.KeyCode.Z) then
		local mouseDirection = RootPart.CFrame:toObjectSpace(mouse.Hit).LookVector
		
		if rightShoulder then
			rightShoulder.C0 = rightShoulder.C0:Lerp(CFNew(1, .5, 0) * CFAng(0, -asin(mouseDirection.x), 0) * CFAng(asin(mouseDirection.y), 0, 0) * CFAng(-1.570796, math.rad(90), 3.141593), .3)	
		end
	else
		if rightShoulder then
			rightShoulder.C0 = rightShoulder.C0:Lerp(shC0, .3)
		end
	end
end)

Thanks if you can help, and thanks if you can’t

Try this out:

local RS = game:GetService("RunService")
local PS = game:GetService("Players")

local player = PS.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

RS.Stepped:Connect(function()
	if char then
		char.RightUpperArm.RightShoulder.Transform = CFrame.new()
		char.RightLowerArm.RightElbow.Transform = CFrame.new()
		char.RightHand.RightWrist.Transform = CFrame.new()
	end
end)

image


Check this out to read more about it.

1 Like

I put this in and it gives the same result…

local character = game.Players.LocalPlayer.Character
local RootPart = character:WaitForChild("HumanoidRootPart")
local rightShoulder = character:FindFirstChild("Right Shoulder", true)
local shC0 = rightShoulder.C0
local shYOff = shC0.Y

local mouse = game.Players.LocalPlayer:GetMouse()

local uis = game:GetService("UserInputService")

local CFNew, CFAng, asin = CFrame.new, CFrame.Angles, math.asin

game:GetService("RunService").RenderStepped:Connect(function()	
	if uis:IsKeyDown(Enum.KeyCode.Z) then
		local mouseDirection = RootPart.CFrame:toObjectSpace(mouse.Hit).LookVector
		
		if rightShoulder then
            rightShoulder.Transform = CFrame.new()
			rightShoulder.C0 = rightShoulder.C0:Lerp(CFNew(1, .5, 0) * CFAng(0, -asin(mouseDirection.x), 0) * CFAng(asin(mouseDirection.y), 0, 0) * CFAng(-1.570796, math.rad(90), 3.141593), .3)	
		end
	else
		if rightShoulder then
			rightShoulder.C0 = rightShoulder.C0:Lerp(shC0, .3)
		end
	end
end)

Switch it to .Stepped instead of .RenderStepped. It should work.

3 Likes

Oh my gosh you’re a life saver :pray: thank you!!

1 Like