How do I eliminate the start up time when the turret turns?

I am working on a turret turning system and the turret is finally turning to when my mouse is pointing at. However, for some reason, the turret doesn’t turn for a while. It waits for a bit before starting to turn. Anyone know why?

https://gyazo.com/6d83ccec833929e14140462db94ccaa2

Please provide us your code so that we can help you!

local invisBox = game.Workspace.testHeadmodel.Invisbox
local mouse = game.Players.LocalPlayer:GetMouse()
local bodygyro = invisBox.BodyGyro

while wait() do
	
	bodygyro.CFrame = CFrame.new(bodygyro.Parent.Position ,Vector3.new(mouse.Hit.Position.X, invisBox.Position.Y, mouse.Hit.Position.Z) )
	
end

Put a “WaitForChild” into the variables. Also try using RenderStepped instead of “wait ()”:

local RunService = game:GetService("RunService")
local invisBox = game.Workspace:WaitForChild("testHeadmodel").Invisbox
local mouse = game.Players.LocalPlayer:GetMouse()
local bodygyro = invisBox:WaitForChild("BodyGyro")

RunService.RenderStepped:Connect(function()
   bodygyro.CFrame = CFrame.new(bodygyro.Parent.Position ,Vector3.new(mouse.Hit.Position.X, invisBox.Position.Y, mouse.Hit.Position.Z) )
end)

Please write again if it is still delayed!

There is still a delay but I think the delay is less now but still too long.

I will try to recreate this in studio. Please wait a bit!

Can you please take a look at the BodyGyro values right after the game started and tell me if anything changes? I am not sure whether it is due to the connection to the workspace part or to something else.

The body gyro values don’t change. D is 3000 MaxTorque is 0,99999,0 P is 99999. hmm I will try union the parts instead of welding them.

Yeah this is a good idea. Maybe also make the part massless.

Same result :CCCCCCCCCCCCCCCCCC

Is this one the server or the client, wait your using mouse nevermind

Hmm, wait why are you using a BodyGyro? @karalilykara

I am using BodyGyro so the turret doesn’t instantly snap to the mouse position. I want a bit of traverse time for the turret. I couldn’t think of other alternatives.