Hello, I have made a script that gets a dummy to rotate to the direction it is shooting, but the problem is that the dummy also tilts which is unwanted.
Is there any way to maybe lock a certain rotation to stop the dummy from tilting?
https://gyazo.com/f5466be6b0ee60a851b5efcd42dc49bd
Here is the script.
repeat local waittime = script.Parent.Cooldown.Value wait(waittime) local parts = game.Workspace.Enemies:GetChildren() local part = script.Parent.Head local function faceNearestBlock(part, blocks, maxDistance) local closestPart local minDistance = maxDistance for _, partToFace in ipairs(parts) do local distance = (part.Position - partToFace.Head.Position).magnitude if distance < minDistance then closestPart = partToFace minDistance = distance end end if closestPart then part.CFrame = CFrame.new(part.Position,closestPart.Head.Position) end end faceNearestBlock(part, parts, 100) until script.Disabled == true