Issues with CFrame:lookat()

Tried this already, same result. I’m going to keep looking through any code that changes the HRP position and get back to you.

1 Like

I’d say that would have to be your problem, what happens if you add a very short task.wait() in there?

1 Like

You should not use cframe:lookat, use cframe.new instead

1 Like

Found no instances of other code tampering with the HumanoidRootPart position. Interestingly enough, putting it in a while task.wait(1) loop makes it work, but shortening that time makes it no longer work. I believe it is due to the HRP.Position variable not updating fast enough, therefore the player has to “backstep” a little bit. I’m not really sure how to fix this, and I think it may be more of a platform or script performance load issue.

1 Like

CFrame.new(pos, posToLookat) is deprecated. I will try it, but I am trying to avoid using deprecated functions

1 Like

Oh, I thought it was the other way around: CFrame.lookAt is deprecated and you have to use CFrame.new instead.

1 Like

No, unfortunately not. Either way, using CFrame.new still gives the same issue.

1 Like

CFrame.lookat is not deprecated according to the documentation.

2 Likes

It seems to almost be a sort of “Rubber band-ing” type of network delay issue, where the player sees themselves move before the server sees it.

1 Like

That seems to be the issue. I was going to toy with networkownership, but that doesn’t work either. I know there’s other games that do it and it works perfect, so I don’t see what I’m doing wrong (unless they use some other unknown method). It’s worth mention that :PivotTo worked only once when I tried it, then stopped rotating.

1 Like

You could maybe try some sort of modulescript placed in replicatedstorage that you can send the players positional data to?

2 Likes

That would only be slower, as then you have to handle transmitting and transferring data. I’m really lost here, maybe there’s some Roblox features I’m unaware of.

1 Like

I’m going to try using a bodygyro and see how that works.

1 Like

I suppose the next best option is a RemoteEvent, I was worried about network usage but Firing a Remote Event rapidly? - #19 by Avigant this thread seems to have people mostly saying it shouldn’t be an issue. not sure what else to try from here without exhausting the network.

1 Like

what happens if you try renderstepped instead of heartbeat

1 Like

You can’t use renderstepped in a server script. Either way, I fixed this by using a body gyro.

1 Like

Alright nice, I have a question though why are you doing this in a server script?

1 Like

The player rotation changing is a core element of the game. I would do it on the client, but I don’t see a reason to. Exploiters could easily change the code in the localscript and gain a huge advantage.

1 Like

Couldn’t exploits just override that though, because the client has full control over their Character? Like just put a local script in your game that makes your character face your mouse hit each render step for example it will override your server code. Or what if you turn on AutoRotate locally wouldn’t that override it too? (I’m assuming u turn AutoRotate off so the Characters cant rotate using shiftlock)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.