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

How do I make the player's arm face towards the mouse?

Asked by 6 years ago

This is kind of hard to explain, but I am trying to make the player's (character's) arm face toward the mouse.

I've tried this using CFrame but the character just glitches out and vibrates strangely...

This is what I've tried so far but nothing I wanted.

arm.CFrame = CFrame.new(arm.Position, Vector3.new(mouse.Hit.p.X, 0, mouse.Hit.p.Z))
0
Try modifying the C0 of the weld that connects the arm to the torso/upper torso itself rather then the CFrame of the arm. RayCurse 1518 — 6y
0
Can I have an example please? Draebrewop 114 — 6y

1 answer

Log in to vote
0
Answered by
OfcPedroo 396 Moderation Voter
6 years ago
Edited 6 years ago

Hmm... Try the following in a script

game.Players.PlayerAdded:connect(function(player)
    repeat wait() until player.Character
    local Mouse = player:GetMouse()
    local arm = --You have to define the arm variable.

    arm.CFrame = CFrame.new(arm.Position, Vector3.new(Mouse.Hit.X, 0, Mouse.Hit.Z))
end)

If this works, please mark as the solution!

As always, good scripting!

0
Nope. "Mouse.X" doesn't exist, nor "Mouse.Z" you have to use mouse.Hit Draebrewop 114 — 6y
0
I just edited. Perhaps that will work. OfcPedroo 396 — 6y
Ad

Answer this question