i found this clip of someone moving and the hand was moving where the player is at
how could i replicate this?
local cframePoint = CFrame.new(hand.Position, character.HumanoidRootPart.Position)
hand.CFrame = cframePoint
This would point the hand towards the player, put it in a loop to make it follow the player. If you want it to be smoother, use a bodygyro.
You can use a bodygyro to make the gun turn to the nearest player
First you’d have to get the players and determine the nearest player using magnitude. Use the humanoidRootPart to determine the distance between the player and the gun
When you locate the nearest player set the bodygyros CFrame to the players HumanoidRootPart. Id put the code in a loop so it continuously does this
No, bodygyro is depracated try using linear velocity
Do not use these they have been deprecated, use vector forces
linear velocities dont work with rotation
not exactly, body gyro was replaced by aling orientation
srry i wanted to say alingn orientation
I think you can use cframe lookat
ok so you just need to make a part of the size of the gun, like a hitbox and weld the gun to the main part and then change the orientation of that part looking for the nearest player
yeah, is a best practice actually
it works as the first guys solution but it doesn’t face the correct position
doesn’t work arm doesn’t face the correct position
Try changing the arm rotation?
how would i be able to do that?
I think you might be able to add orientation to the arm through cframe?
i dont know how to do that, and how would i be able to code that?
local cframePoint = CFrame.new(hand.Position, character.HumanoidRootPart.Position) * CFrame.Angles(math.rad(90), 0, 0)
hand.CFrame = cframePoint
CFrame.angles will add a degree offset to the arm movement, this is just an example so you need to play around with the numbers to get the offset right. Instead of 90 try -90 and if that doesn’t work try moving the math.rad(90) to the y coordinate or z coordinate.