(not sure why it makes u download )
I’ve never ran into this issue before in all my time using lookat, and I’ve tried many other solutions. Is there something I’m missing, or…
(Forgot to include the code, lol)
rs.Heartbeat:Connect(function(t)
if cameraSwitched == true then
hrp.CFrame = CFrame.lookAt(hrp.Position, Vector3.new(enemyHRP.Position.X, hrp.Position.Y, enemyHRP.Position.Z))
end
--disregard
if blocking.Value == false then
shield.Visible = false
end
end)
I’m not familiar with this constructor but it seems as though it is affecting the CFrame’s positional values on a set standard, yet adjusting the CFrame’s rotational values differently. I can’t see it in the code you’ve provided so I’ll ask what exactly you are setting the “hrp” variable with/to?
The HRP variable is the player’s HumanoidRootPart. I am attempting to make it rotate to the Enemies HumanoidRootPart (sorry if i did not make this clear). The rotation works, but the player is stuck in place for… some reason.
My current working theory is that for some reason the players humanoid root part CFrame is not updated, therefore when you try to move the game think’s you’re still at your last spot and the new lookat CFrame sets it to where you were before.
As you commented this I was just act to do this. The function prints the same position but an ever so slightly different rotation. (The rotation is slightly different even when neither of the HRP’s are moving).
Just out of curiosity, can you try setting a variable before running Cframe.lookat() and set the variable to the position prior to using the lookat(). Not sure why the position isn’t updating unless it is lagging behind because of the hrp variable.
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.
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.
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.