I'm completely aware of tweening and lerping but i don't really know how to do it in this situation.
The script is working 100% well, but i just want it to be smoother;
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 |
06 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
07 | Humanoid.AutoRotate = false |
08 | local HMR = Character:WaitForChild( "HumanoidRootPart" ) |
09 |
10 | local Mouse = Player:GetMouse() |
11 |
12 | local RC 0 = CFrame.new( 1 , . 5 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , - 1 , 0 , 0 ) |
13 | local RC 1 = CFrame.new(-. 5 , . 5 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , - 1 , 0 , 0 ) |
14 |
15 | local LC 0 = CFrame.new(- 1 , . 5 , 0 , 0 , 0 , - 1 , 0 , 1 , 0 , 1 , 0 , 0 ) |
If this is a ServerScript, you can use RunService's Stepped event, that fires every frame prior to the physics simulation.
1 | while game:GetService( "RunService" ).Stepped:wait() do |
2 | --// Rest of code |
3 | end |
OR - The code is the same, just formatted differently.
1 | local RS = game:GetService( "RunService" ) |
2 |
3 | while RS.Stepped:wait() do |
4 | --// Rest of code |
5 | end |
If this is a LocalScript, you can use the same thing, except using RenderStepped instead of Stepped. This fires every frame prior to the frame being rendered.
1 | while game:GetService( "RunService" ).RenderStepped:wait() do |
2 | --// Rest of code |
3 | end |
OR - The code is the same, just formatted differently.
1 | local RS = game:GetService( "RunService" ) |
2 |
3 | while RS.RenderStepped:wait() do |
4 | --// Rest of code |
5 | end |
Either way, these will be fired every frame.
RenderStepped can only be called in a LocalScript.
Stepped can only be called in a ServerScript.
(You could use RunService.Heartbeat:wait(), which can only be used in a LocalScript, but I'd use RenderStepped over Heartbeat)
Hope this helped! Feel free to select this as an answer if this worked for you!
Documentation + API