Hello, I am making a table tennis like game where I want the racket to move on the Z axis, I made a brief prototype which has a lot of bugs with the movement on the axis, it usually just bugs when you move your mouse too fast. How would I be able to achieve a smooth version of this? Thanks.
This is my code:
local mouse = game.Players.LocalPlayer:GetMouse()
game:GetService("RunService").RenderStepped:Connect(function()
if mouse.Hit then
workspace.main.PrimaryPart.Position = Vector3.new(workspace.main.PrimaryPart.Position.X, workspace.main.PrimaryPart.Position.Y, mouse.Hit.p.Z)
end
end)