Character Is Having a Seizure

Hi all,

Recently I’ve been working on a tennis game with interesting game mechanics. Here I’m trying to make the player face where the player’s mouse is pointed at. At first it works really fine…until I started walking.

https://streamable.com/pvr2f5

You can notice the weird choppy movement my character has once I start moving in a different direction from the one my mouse is pointed at. I wouldn’t really have a problem with that if it didn’t influence the direction of the tennis ball.

Here’s the code:

local Mouse =  Player:GetMouse()
RunService.RenderStepped:Connect(function()
	repeat wait() until game.Workspace:FindFirstChild("Ball")

	local ball = game.Workspace.Ball
	local character = Player.Character
	local humanoid = character:WaitForChild("Humanoid")
	if ball then
		if humanoid.Health > 0 then
			character.HumanoidRootPart.CFrame = CFrame.new(character.HumanoidRootPart.Position, Vector3.new(Mouse.Hit.p.X, character.HumanoidRootPart.Position.Y, Mouse.Hit.p.Z))
		end
	end
end)

How can I avoid the weird movement as shown above in the video?

Thanks in advance!

2 Likes

Waiting in renderstepped isn’t a good idea. That might be why.

I have tried it in while wait() do as well. Same result.

Maybe disable AutoRotate, set it to false it’s a humanoid property.

3 Likes

I swear everytime I have a very specific issue you guys pull a random property that nobody’s ever heard of out of nowhere :joy:

thank you so much for the help!!!