Hello, today I was scripting where the humanoid moves with the mouse and it transfers through a Remote Function (For a skill I’m making) , how ever, it keeps up ending in a bugged Cframe state.
If anyone can help, that would be amazing! Video :
Edit : It was solved
The renderstepped event is going to fire every frame. Like, if the game is 30 FPS it will fire 30 times per second.
You will not be able to use tweenservice to move something if you fire an event on every frame, I think.
If you want to move a model, it is better to use PivotTo() on the model. (Aka character in this case.)
https://developer.roblox.com/en-us/api-reference/function/PVInstance/PivotTo
Mayby you should also take the Humanoid.Hipheight into account. Otherwise you might try to move the character to somewhere halfway buried in the ground.
local remote = game:GetService("ReplicatedStorage").RemoteEvent
remote.OnServerEvent:Connect(function(player, mousePosition)
local character = player.Character
local humanoid = character:FindFirstChildOfClass("Humanoid")
local HumanoidRootPart = character.HumanoidRootPart
character:PivotTo(CFrame.new(mousePosition-Vector3.new(0,-humanoid.HipHeight,0)))
end)
It still looks pretty crazy, though, so this is not really a solution. 
You need some way to limit the maximum speed. AlignPosition has a way to limit speed. But I am not sure it will work for a part that is inside a humanoid. You could use an invisible non-collide “helper” part and use PivotTo() to move the character to the location of the part.
https://developer.roblox.com/en-us/api-reference/class/AlignPosition
Alternatively, you might need a way to freeze the camera while the skill is active, so that the character does not fly off into the distance. Otherwise, I think it will be pretty hard for the player to control the skill, in any case.
It looks like the humanoid is trying to force the character to be upright, or put it into the falling state. You should anchor the humanoid, and/or enable PlatformStand on it while using this. That may fix your issue.
Thank you, just found out it was the humanoidrootpart not being anchored.
1 Like