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:
01 | local Player = game.Players.LocalPlayer |
02 | local Character = Player.CharacterAdded:wait() ; Character = Player.Character |
03 | local Torso = Character:WaitForChild 'Torso' |
04 | local Neck = Torso:WaitForChild( "Neck" ) |
05 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
06 | Humanoid.AutoRotate = false |
07 | local HMR = Character:WaitForChild( "HumanoidRootPart" ) |
08 |
09 | local Mouse = Player:GetMouse() |
10 |
11 | local NeckC 0 = Neck.C 0 |
12 | local NeckC 1 = Neck.C 1 |
13 |
14 | game:GetService( "RunService" ).RenderStepped:connect( function () |
15 | wait( 0.034 ) |
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
01 | Local player = game:GetService( "ReplicatedStorage" , game.Workspace) |
02 |
03 | function ChildAdded() = BrickColor.new( "Black" ) |
04 | if function is = = nil then |
05 | local RC 0 = CFrame.new( 1 , . 5 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , - 1 , 0 , 0 ) |
06 | local RC 1 = CFrame.new(-. 5 , . 5 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , - 1 , 0 , 0 ) |
07 | if child ~ = nil then |
08 | function Test 1 (playeraddedevent) |
09 | once player.Humanoid.CFrame = CFrame.Vector.New(( "Humanoid" )) then he'll |
10 | Get( "Service" ):ChildAddict( function () |
11 | local Character = Player.CharacterAdded:wait() ; Character = Player.Character |
12 | local Torso = Character:WaitForChild 'Torso' |
13 | local Neck = Torso:WaitForChild( "Neck" ) |
14 | local LeftShoulder = Torso:WaitForChild( "Left Shoulder" ) |
15 | local RightShoulder = Torso:WaitForChild( "Right Shoulder" ) |
1 | local tweenService = game:GetService( "TweenService" ) |
2 | local player = game.Players.LocalPlayer |
3 | local mouse = player:GetMouse() |
4 |
5 | game:GetService( "RunService" ).RenderStepped:Connect( function () |
6 | 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) } ) |
7 | tween:Play() |
8 | 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!