Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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))

2 comments

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.

0

Can I have an example please?

1 answer

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!

2 comments

0

Nope. "Mouse.X" doesn't exist, nor "Mouse.Z" you have to use mouse.Hit

0

I just edited. Perhaps that will work.

This discussion is preserved as it was. New answers, comments, and votes are closed.