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

How would I angle the arms based on where the player is looking?

Asked by 10 years ago

In an FPS I am designing, I need the player's arms to move up or down in reference to where the player is looking on the Y Axis. If possible, I would like them to move even if an animation (like swinging a sword) is playing. Could anyone help me out?

3 answers

Log in to vote
0
Answered by 10 years ago

Do you have a script someone could look at?

0
Not on-hand, no. I'm currently using a phone. Aaronoles 55 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

From all my knowledge i'm assuming you would have to change the camera position.


game.Workspace.CurrentCamera -- Can only be accessed in a localScript

After you got the players camera you would have to target the camera on a block that would be just a few studs away from the players first person vision. (Assuming it would be locked in first-person) And maybe changing the cameras type in the process.

http://wiki.roblox.com/index.php?title=CameraType_(Enum)

I'm still learning Lua, so i'm not SUPER PRO to answer these questions. But i tried, so please don't downvote.

Log in to vote
0
Answered by 3 years ago

for FPS I prefer to use R6 real arms this is my local script:

plr = game.Players.LocalPlayer;
repeat wait() until plr.Character
char = plr.Character
m = plr:GetMouse()
game["Run Service"].RenderStepped:connect(function()
local c = game.Workspace.CurrentCamera

char.HumanoidRootPart["RootJoint"].C0 = CFrame.new(0,0,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55,3.15,0)

    char.Humanoid.CameraOffset = (char.HumanoidRootPart.CFrame+Vector3.new(0,0,0)):pointToObjectSpace(char.Head.CFrame.p + Vector3.new(0,-1.46,0))

end)

Answer this question