look = heartbeat:Connect(function()
local camcf = camera.CFrame
if nearest then
camera.CFrame = CFrame.lookAt(camcf.Position,nearest.Position)
end
if not busy.Value then
local x,y = camcf:ToOrientation()
rootpart.CFrame = CFrame.new(rootpart.Position)*CFrame.Angles(0,y,0)
end
end)
It’s choppy because of network replication.
To avoid it do it entirely locally.
Psuedocode does not work do not copy and paste:
--on client fire server and tell server the target
client:FireServer(enemyPlayerModel)
--onServer send information to all clients
.OnServerEvent:Connect(function(player, enemyPlayermodel)
someEvent:FireAllClients(player, enemyPlayermodel)
end)
--On client event run the heartbeat connection
.OnClientEvent:Connect(function(playerAttacker : Player, enemyPlayermodel : Model)
look = heartbeat:Connect(function()
local camcf = camera.CFrame
--Heartbeat stuff, do it with the player and enemyPlayerModel variables given
end)
Of course make sure to :Disconnect() the connection when the player decides to stop targeting a model.
it took me a while to understand that lmao
so youre saying, do it in everyones client and not the server?
You only need to do it on the player’s client, since the character replicates to the server
I just got back into Roblox and found the solution…
JUST TURN OFF AUTO ROTATE
2 Likes