I'm trying to make a dodge which suspends you in the air while also moving you in one direction, i have achieved that by using tweenservice and CFrame, the only problem is whenever I run this code it turns my player in a fixed rotation, right now my player moves right but my character is looking forward. this is my code
game.ReplicatedStorage.Dodge.OnServerEvent:Connect(function(player) local tweenService = game:GetService("TweenService") local part = player.Character.HumanoidRootPart game.Workspace.DodgeCircle.Transparency = 0 player.Character.HumanoidRootPart.Anchored = true local goal = {} goal.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position + Vector3.new(25,0,0)) local tweenInfo = TweenInfo.new(.2) local tween = tweenService:Create(part, tweenInfo, goal) tween:Play() wait(.2) game.Workspace.DodgeCircle.Transparency = 1 player.Character.HumanoidRootPart.Anchored = false end)
I Fixed this by adding CFrame.Angles into my script the final script looks something like this
game.ReplicatedStorage.Dodge.OnServerEvent:Connect(function(player) local tweenService = game:GetService("TweenService") local part = player.Character.HumanoidRootPart game.Workspace.DodgeCircle.Transparency = 0 player.Character.HumanoidRootPart.Anchored = true local goal = {} goal.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position + Vector3.new(25,0,0)) * CFrame.Angles(0, -1.5, 0) local tweenInfo = TweenInfo.new(.2) local tween = tweenService:Create(part, tweenInfo, goal) tween:Play() wait(.2) game.Workspace.DodgeCircle.Transparency = 1 player.Character.HumanoidRootPart.Anchored = false end)