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

How would I apply tweenservice to this script?

Asked by
Lyphios 77
4 years ago
Edited 4 years ago

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:

01local Player = game.Players.LocalPlayer
02local Character = Player.CharacterAdded:wait() ; Character = Player.Character
03local Torso = Character:WaitForChild'Torso'
04local Neck = Torso:WaitForChild("Neck")
05local Humanoid = Character:WaitForChild("Humanoid")
06Humanoid.AutoRotate = false
07local HMR = Character:WaitForChild("HumanoidRootPart")
08 
09local Mouse = Player:GetMouse()
10 
11local NeckC0 = Neck.C0
12local NeckC1 = Neck.C1
13 
14game:GetService("RunService").RenderStepped:connect(function()
15    wait(0.034)
View all 22 lines...

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.

0
instead of using the closest to the minimum, why dont you just use the minimum? AlexanderYar 788 — 4y
0
That makes an unnoticeable difference Lyphios 77 — 4y
0
You forgot to put Torso in parenthesis/brackets after WaitForChild on line 3. AntiWorldliness 868 — 4y
0
That didn't make a difference Lyphios 77 — 4y

2 answers

Log in to vote
0
Answered by
99Of19 -10
4 years ago

The problem is you're not thinking correctly about the Local Script

01Local player = game:GetService("ReplicatedStorage", game.Workspace)
02 
03function ChildAdded() = BrickColor.new("Black")
04if function is == nil then
05local RC0 = CFrame.new(1, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
06local RC1 = CFrame.new(-.5, .5, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
07if child ~= nil then
08function Test1(playeraddedevent)
09once player.Humanoid.CFrame = CFrame.Vector.New(("Humanoid")) then he'll
10Get("Service"):ChildAddict(function()
11local Character = Player.CharacterAdded:wait() ; Character = Player.Character
12local Torso = Character:WaitForChild'Torso'
13local Neck = Torso:WaitForChild("Neck")
14local LeftShoulder = Torso:WaitForChild("Left Shoulder")
15local RightShoulder = Torso:WaitForChild("Right Shoulder")
View all 23 lines...
0
are you trolling Lyphios 77 — 4y
0
I'm only trying to help 99Of19 -10 — 4y
0
it did nothing Lyphios 77 — 4y
0
I reported that guy. He's been doing the same thing on other questions. AntiWorldliness 868 — 4y
0
It's obviously a troll IIFRC, look at his joined date and his Roblox account. Thankfully, he's been suspended. JesseSong 3916 — 3y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
1local tweenService = game:GetService("TweenService")
2local player = game.Players.LocalPlayer
3local mouse = player:GetMouse()
4 
5game: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()
8end)

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!

Answer this question