So this script makes the player's head follow the mouse, and to simulate "realism", I put a "wait(0.034)", which is the approximate minimum time a wait can be. But the problem is, it's a bit choppy. I was thinking about reducing the choppiness by using a renderstepped:Wait(), but I have no clue how to do this, and it'd still be pretty choppy. So Here's the script:
local Player = game.Players.LocalPlayer local Character = Player.CharacterAdded:wait() ; Character = Player.Character local Torso = Character:WaitForChild'Torso' local Neck = Torso:WaitForChild("Neck") local Humanoid = Character:WaitForChild("Humanoid") Humanoid.AutoRotate = false local HMR = Character:WaitForChild("HumanoidRootPart") local Mouse = Player:GetMouse() local NeckC0 = Neck.C0 local NeckC1 = Neck.C1 game:GetService("RunService").RenderStepped:connect(function() wait(0.034) local cf = workspace.CurrentCamera.CFrame.lookVector.Y local Kek = CFrame.Angles(0, 0, math.asin(Mouse.Origin.lookVector.Y)) Neck.C0 = NeckC0 * CFrame.Angles(math.asin(Mouse.Origin.lookVector.Y), 0, 0):inverse() HMR.CFrame = CFrame.new(HMR.Position, Vector3.new(Mouse.Hit.p.x, HMR.Position.Y, Mouse.Hit.p.z)) end)
In line 15, you can see the wait I put. How can I tween this to make it smoother? Sorry if my wording isn't write, I've never actually used tweenservice before.
The problem is you're not thinking correctly about the Local Script
Local player = game:GetService("ReplicatedStorage", game.Workspace) function ChildAdded() = BrickColor.new("Black") if function is == nil then local RC0 = CFrame.new(1, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) local RC1 = CFrame.new(-.5, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0) if child ~= nil then function Test1(playeraddedevent) once player.Humanoid.CFrame = CFrame.Vector.New(("Humanoid")) then he'll Get("Service"):ChildAddict(function() local Character = Player.CharacterAdded:wait() ; Character = Player.Character local Torso = Character:WaitForChild'Torso' local Neck = Torso:WaitForChild("Neck") local LeftShoulder = Torso:WaitForChild("Left Shoulder") local RightShoulder = Torso:WaitForChild("Right Shoulder") local Humanoid = Character:WaitForChild("Humanoid") Humanoid.AutoRotate = false local HMR = Character:WaitForChild("HumanoidRootPart") end) local CFrame = local Mouse = Player:GetMouse("nil") print("Your welcome")
local tweenService = game:GetService("TweenService") local player = game.Players.LocalPlayer local mouse = player:GetMouse() game:GetService("RunService").RenderStepped:Connect(function() local tween = tweenService:Create(player.Character:WaitForChild("HumanoidRootPart", TweenInfo.new(.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {CFrame = CFrame.new(mouse.Hit.p)}) tween:Play() end)
Not sure how to explain it to you, but I think you can figure out what's happening in the script. I had to use someone else's script because I had almost forgotten how to do this, so I guess I'm learning too. I edited the script so hopefully it would be close to what you wanted. If you have questions, I will try to give you the best answer as soon as possible!