I wanted to know if there was a better way to make a part face your mouse constantly other than:
Local Script
local player = game.Players.LocalPlayer;
local mouse = player:GetMouse();
local rs = game:GetService('ReplicatedStorage');
local re = rs:FindFirstChild('RemoteEvent') or rs:WaitForChild('RemoteEvent');
local rf = rs:FindFirstChild('RemoteFunction') or rs:WaitForChild('RemoteFunction');
mouse.Button1Down:connect(function()
re:FireServer()
end)
rf.OnClientInvoke = function()
return mouse.Hit.p
end
Script
local rs = game:GetService('ReplicatedStorage');
local re = rs:FindFirstChild('RemoteEvent') or rs:WaitForChild('RemoteEvent');
local rf = rs:FindFirstChild('RemoteFunction') or rs:WaitForChild('RemoteFunction');
re.OnServerEvent:connect(function(player)
local part = Instance.new('Part', workspace);
part.Anchored = true;
part.CFrame = player.Character.Head.CFrame;
while wait() do
part.CFrame = CFrame.new(part.CFrame.p, rf:InvokeClient(player));
end
end)

2 comments
Are you implying that this is the only way to accomplish the task and that this is the only improvement that can be made? When I ran it myself, it felt really laggy, so is there a better, less laggier way, or just this?
You can also try to smoothly transition between the positions. There is no other way except by doing it locally.