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

How can I point the players head and body to their mouse with my script?

Asked by
Teeter11 281 Moderation Voter
9 years ago

So I have this script I use in my FPS games but it looks weird when I just point the head to the players mouse. How can I make this script point the head AND the body to the mouse. This is in a LOCALSCRIPT in the players STARTERGUI.


function load() game.Players.LocalPlayer.CameraMode = "LockFirstPerson" Tool = script.Parent Player = game.Players.LocalPlayer Camera = game.Workspace.CurrentCamera Mouse = Player:GetMouse() local weld1 = Instance.new("Weld") weld1.Parent = Game.JointsService weld1.C1 = Player.Character.Head.CFrame:toObjectSpace(Player.Character.Torso.CFrame) weld1.Part0 = Player.Character.Torso weld1.Part1 = Player.Character.Head local oldMouseDir = Mouse.UnitRay.Direction game:GetService("RunService").RenderStepped:connect(function() weld1.C1 = CFrame.new(Player.Character.Head.CFrame.p,Player.Character.Head.CFrame.p + oldMouseDir):toObjectSpace(Player.Character.Torso.CFrame) -- part where it CFrames to the players mouse oldMouseDir = Mouse.UnitRay.Direction end) end wait(2) --wait for player to spawn load()

Thanks!

0
Just go to starterplayer and change CameraType to LockPlayerFirstPerson EzraNehemiah_TF2 3552 — 9y
0
Its a 3rd person game Teeter11 281 — 9y

Answer this question