Player slowly moving upwards when trying to force the player to look in a certain direction

Hello, DevForum!

For an RPG I’m making, I need the player to be constantly looking south (this is for something in the future), so I’ve tried some methods, most of them have their problems, like being able to still wiggle and face other directions.

Currently, this is the method I’m using

local function onRenderStep()
	-- Some code above here...
	local currentPosition = humanoidRootPart.Position 
	local targetPosition = south.Position -- South is a predefined part
		
	humanoidRootPart.CFrame = CFrame.new(currentPosition, targetPosition)
end

-- Binding the function to renderstep

This is the problem when using it though

As you can see, when moving I am constantly going backwards.

A few things that might cause this but I’m not sure:

  • Baseplate is at a tilt of 28, 0, 0
  • South is straight with no tilt

I don’t think any of those are the culprit, but I just wanted to put it out in case.

If you think you know whats causing this or know an alternative to this that does work please let me know!

Couldn’t you just disable the Humanoid’s AutoRotate property and set where you want the Character to look at?

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local HRP = Character:WaitForChild("HumanoidRootPart")
local south = workspace.South

Humanoid.AutoRotate = false
HRP.CFrame = CFrame.new(HRP.Position, south.Position)
1 Like

Hmm, I’ll try it out. I never knew that property existed…

You learn something new everyday lol

This property basically determines if you want your Character to rotate at all, if it’s set to false then the Character would only move in the current position it’s looking at

I believe why it’s moving upwards is cause you’re encasing it inside a RenderStepped event, so it’s constantly moving every time perhaps?

Hm, how could I try to fix that?

Did you try the script I sent? And it could be possible that your Baseplate could be tilted which could be causing that strange effect?

1 Like

Yes, I have. It’s still slowly moving me up, and no it’s not the baseplate. I tried setting it to 0, 0, 0 but no change.

The only thing I could think of is that you have some kind of Velocity property that’s assigned to the Baseplate, or you’ve welded something to it then

A Baseplate shouldn’t just slowly move your Character though

1 Like

No, I think I know the problem.

South.Position will return the absolute middle part of south, with can end up being “downwards”, as the map is tilted. This causes the player to try to move downwards and forwards messing up the original goal. Is there any way to instead of going to a part, going to "Due South"
Red = South
Blue Dot = Middle

You can see that middle is upwards and the player can’t reach it

As @Jackscarlett said, you probably have a Velocity in the Baseplate.
And your information is misleading. Up is a direction vertically. Your video shows you are moving backward in relation to your character.

Uh, sorry for the misleading terms.

Can you at least double check that the AssemblyLinearVelocity properties are all set to 0? If this only happens in the Baseplate alone and not in another part, that’s probably why

Screen Shot 2021-05-03 at 11.19.43 AM

It’s working completely fine on my side? I don’t know why it’s not working for you

Are there are other parts that are welded to the Baseplate? If not, I’ll send you a place template so you can see my side on it

Nothing welded, can you send the place file please?

There might be a difference in how we binded the functions or what you set up in your script, idk.

All I did, was just create a Baseplate, inserted a LocalScript inside StarterPlayerScripts, and then created a Part inside the workspace

HMMM.rbxl (28.3 KB)

Oh, I was calling it every frame :man_facepalming:

RIP

Yeah RenderStepped will do that, just be aware to try out lines of code given to you in an entirely new script

1 Like