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

Right arm following mouse in a weapon?

I'm trying to make a gun where your right arm follows your mouse when it's equipped. Here's what I have:

player = game.Players.LocalPlayer
repeat wait() until player.Character
char = player.Character
shoulder = char.Torso["Right Shoulder"]
original = shoulder.C0
active = false

function onEquipped(mouse)
	active = true
	
	while active == true do
		shoulder.C0 = CFrame.new(shoulder.C0.p, mouse.Hit.p)
		wait()
	end
end

script.Parent.Equipped:connect(onEquipped)

script.Parent.Unequipped:connect(function()
	active = false
	shoulder.C0 = original
end)

When I try to aim forward, my arm is facing to the right of me. When I aim right, my arm points behind me. Any ideas on how I'd fix this?

3 comments

0

What happens if you use C1 instead of C0?

0

That keeps my arm in front of me, and my arm twists when I spin my camera around

2

I've made an answer previously that should help you, but it does not involve using the player's left/right shoulders. You can read it here: https://scriptinghelpers.org/questions/17657/make-arms-follow-mouse-like-fps#21126

1 answer

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