Basically I have an animation in my game, after it plays the humanoid is meant to teleport to a specific spot. However, it seems to go there for a millisecond, then weirdly, it snaps back to its original position? I don't understand why this is happening, below is my code and a video
local character = game.Workspace.mainbacon
local event3 = game.ReplicatedStorage.BombEvent
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
event.Event:Connect(function(plr)
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://74795693307326"
local animTrack = animator:LoadAnimation(animation)
animTrack.Priority = Enum.AnimationPriority.Action4
while animTrack.Length == 0 do
print("Loading... Time Taken So Far:")
task.wait(0.01)
end
animTrack:Play()
character.HumanoidRootPart.CFrame = game.Workspace.mainbacon.LowerTorso.CFrame
animTrack:AdjustSpeed(0.4)
task.wait(animTrack.Length / 0.4 - 0.05)
local speed = animTrack.Speed
print("wha")
animTrack:AdjustSpeed(0)
character.HumanoidRootPart.CFrame = game.Workspace.mainman.HumanoidRootPart.CFrame
task.wait(3)
animTrack:AdjustSpeed(1000)
--[[animation:Destroy()
animTrack:Destroy()]]
task.wait(3)
print(character.HumanoidRootPart.CFrame)
--task.wait(2)
character.HumanoidRootPart.CFrame = game.Workspace.mainman.HumanoidRootPart.CFrame
print(character.HumanoidRootPart.CFrame)
--task.wait(2)
character.HumanoidRootPart.CFrame = game.Workspace.mainman.HumanoidRootPart.CFrame
print(character.HumanoidRootPart.CFrame)
--task.wait(2)
character.HumanoidRootPart.CFrame = game.Workspace.mainman.HumanoidRootPart.CFrame
end)``` most of this code is just commented code that i don't use anymore or random things i used to try to fix this
** You are now Level 14! **