Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does changing the rotation of the arm affect the position of it?

Asked by 3 years ago
Edited 3 years ago

I'm trying to make the arm point towards the mouse, but when I run the game, the arm goes flying whenever I move the mouse. I didn't change the position of the arm, so why does it do this?

Here's the code:

local RS = script.Parent.RightUpperArm['RightShoulder']
local mouse = game.Players:GetPlayerFromCharacter(script.Parent):GetMouse()

game:GetService('RunService').RenderStepped:Connect(function()
    local mh = mouse.Hit.p

    RS.C0 = CFrame.new(RS.Parent.RightShoulderRigAttachment.OriginalPosition.Value - mh)
end)

This is a local script and inside StarterCharacterScripts btw.

Answer this question