How to solve this bug?

Hi,
my issue is simple, I found bug, that when I try to rotate servo with limit enabled, it can still go in path, where is the rotation out of limit, and it get stuck on the limit.


Correcrtly it may rotate by the yelow line, but now it rotate around the red line.


Is there any way to how to solve it?

1 Like

Its servo bug, i tried to post bug report, but it was left in state: not, too hard to solve
So i need to find alternative solution made by me

Your post didn’t say much, but I guess the Servo is being offset, there’s nothing you can do about it, if the part is unanchored.

What you can do here is to not use HingeConstraint servos. I found a post on the forum that teaches you how to CFrame a rotating door:

I was having this problem myself, and it gets so frustrating when parts rotates sometimes but doesn’t sometimes for no reason. Like @jacys23 said:

You should really stop using servos and change to CFrame-ing, it really helps :slight_smile:

1 Like

[Alternate solution]

To alter a part’s CFrame in a way that causes it to rotate

for example ,
would be done by utilizing RunService.Heartbeat , as that will run after physics simulation and fires every frame. To rotate a part indefinitely ,
we will use a local script in starterPlayerScripts :

local part = workspace.Part
 
    game:GetService("RunService").Heartbeat:connect(function(dt)
	--changing math.Rad(5.5) to a lower number would decrease the speed at which this would happen
	part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(5.5)*dt*60, 0)
end)

Rotating multiple parts asynchronously

you could do this to rotate multiple parts

local folder_containing_parts = workspace.Folder2
     
     local children = folder_containing_parts:GetChildren()
         for _,kid in pairs (children) do
    	 if kid then 
    		
        game:GetService("RunService").Heartbeat:connect(function(dt)
    	
         kid.CFrame = kid.CFrame * CFrame.Angles(0, math.rad(1)*dt*60, 0)
    end)

    		
    		
    		
    	end
    end 

And to move a part to another position , as @return_end1 modified my script on another post,

local runService = game:GetService("RunService")
local destinationCFrame = workspace.part2.CFrame
local speed = 2

local heartbeat do --Pushing it into a do block for clean syntax
    heartbeat = runService.Heartbeat:Connect(function(step)
        script.Parent.CFrame = script.Parent.CFrame:Lerp(destinationCFrame, step/speed)

        if script.Parent.CFrame == destinationCFrame then
            heartbeat:Disconnect()
            return
        end
    end)
end
1 Like

you say, that I may use cframes, that is great solution, but not when i am moving mesh parts, and i need to rotate every single canon, bec it will cause lag, specialy, when i have more, than 1 models with guns

it doesnt rotate for reason described in the topic

No, it will not cause lag as it is done on the client and is using heartbeat .

Meaning that the quality depends on the machine, eg. the person’s own computer
and on top of that it’s not done by the server for every client, instead it is done separately per client (as it would be a local script in StarterPlayerScripts), with what quality is decided by the machine processor, plus since we are using Heartbeat , it will fire every frame and appear smooth

1 Like