So, I’m making an fps game, and I want the tool to follow the player’s camera. I ended up coming across this post by EgoMoose. However, this is hard for me to follow as I have near no knowledge of this stuff. Then, I found this on scriptinghelpers.orghttps://gyazo.com/abd706d0ec52b4cc80788554fac5b9cc
It is simpler, I can follow it better. Thing is, it is VERY choppy. https://gyazo.com/404939d9f69fd1a8ca34fcd93cae5689
Is there a way to make it smoother? Is there a better method without using ViewModel? If there is no way without using ViewModel, is there a simpler ViewModel method?
Here is the script off of scripting helpers (Note: This is for r6 and the weapon has no handle because I followed headstackk’s animation tutorial.):
plr = game.Players.LocalPlayer; -- local script
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)
This was the best solution I found that was simple to follow:
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local rootJoint = char:WaitForChild(“HumanoidRootPart”)
local camera = workspace.CurrentCamera
local camCf = camera.CFrame
local rot = CFrame.new(camera.CFrame.p)
local angle = 0
local m = plr:GetMouse()
game:GetService(“RunService”).RenderStepped:connect(function()
if game.Players.LocalPlayer.Character.Humanoid.Sit then return end