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.
What do you want to achieve? Disable animations on a specific Motor6D
What is the issue? Cannot figure out how?
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)
--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)
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)
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)