I created a script where it tweens the humanoidrootpart to a position that I set it to and it works but it glitches the player’s camera everywhere and I want it to be more smooth. How would I move the player?
Hey,
how exactly does it glitch the player’s camera, could you pinpoint a block of code that causes the issue?
I would recommend using the PathFindingService and the Humanoids’ MoveTo() function. (unless your wanting the player to float, then you can use PathFindingService and the TweenService together).
the camera will automatically follow and the player will walk around obstacles automatically as well.
So I’m trying to tween the humanoidrootpart to move up to a certain point in the air and when the tweening is in action the players character keeps moving down and moving back up. I’m looking for help to try to stop that.
Could you provide the code you are using please?
local Tween = game:GetService("TweenService")
local Remote = script.Parent:WaitForChild("Remote")
Remote.OnServerEvent:Connect(function(Player)
local Char = Player.Character
local Humanoid = Char:WaitForChild("Humanoid")
local HRP = Char:WaitForChild("HumanoidRootPart")
local HRPTween = Tween:Create(HRP,TweenInfo.new(5,Enum.EasingStyle.Linear),{CFrame = CFrame.new(-67.85, 71.1, -1.45)})
HRPTween:Play()
end)
When are you firing the event on the client, is it in a loop or something?
It’s when the player is near a brick and they are pressing “Q”.
Could you maybe send a gif of what is actually happening, because I don’t see any issue.
Have you tried lerping the HRP
Couldnt you just use a bodyposition force to move the player to the place?
Its smooth, doesnt need to be looped constantly like lerp, and fast/easy to use.
He’d need to delete it after the player reaches the position so it would take up more code.
You may want to Anchor the HumanoidRootPart of the character.
I ran code like this on studio, and the tween works fine while it’s anchored.
Also ensure the tween is only ran once as this may be contributing towards the issue.
More code ~= more lag
Making a tween still creates things and needs to be Destroy() ed as well.
I’m trying to figure out how to stop the camera from glitching all over the place.
Can you post your Local Script?
It looks like you’re running the tween multiple times
I ran the tween on studio inside a loop, and this issue showed for me.
Alright thank you all for the help. I’ll try that out right now.
Make sure to mark something as the solution if you solve it so other people can go to solution straight away!
I know how you can fix it.
Add a check so when the player has arrived to the brick it anchors their humanoidrootpart and then it makes the tween stop after that unanchor it.
Boom fixed.