Hello everyone, I am trying to make this flying object that faces that mouse from the moment its moves everything works without any bugs but for some reason, the object starts to rotate 180 degrees without me wanting it to.
the front of the stone has a red spot and after flying for a second or so it randomly rotates here is the script I used for it
if ability == "TaktB" then
if not SkillsReady then return end
if not TaktCD then return end
TaktCD = false
local character = player.character
local Root = character.HumanoidRootPart
local Mouse = player:GetMouse()
local Rock1Copy = game.ReplicatedStorage:FindFirstChild("Rocks"):Clone()
Rock1Copy.Parent = game.Workspace.Ignore
Rock1Copy.CFrame = Root.CFrame + Vector3.new(0,10,0)
Rock1Copy.Anchored = true
local connection
local StartTime = os.clock()
connection = RunService.Heartbeat:Connect(function(dt)
if os.clock() >= StartTime+3 then
connection:Disconnect()
Rock1Copy:Destroy()
end
wait(0.5)
Rock1Copy.CFrame = CFrame.new(Rock1Copy.Position) + mouseHit.LookVector * dt * 165
local mPosition = mouseHit.Position
Rock1Copy.CFrame = CFrame.lookAt(Rock1Copy.Position, mPosition)
end)
wait(1.2)
TaktCD = true
end
Thanks a lot and have a nice day
(this is a repost i really want to know what is making this problem)