I’ve been cursing my screen for the last hour because I have no idea why this is happening, I’m pretty sure it’s a small detail, but I can’t find it
--Full code
local TweenService = game:GetService("TweenService")
local Waypoints = game.Workspace.Waypoints
local Root = script.Parent.HumanoidRootPart
for Number = 1, #Waypoints:GetChildren() do
local Waypoint = Waypoints[Number]
local Distance = (Root.Position - Waypoint.Position).Magnitude
local Velocity = 2.5
local MoveToInfo = TweenInfo.new(Distance/Velocity, Enum.EasingStyle.Linear)
local RotateInfo = TweenInfo.new(0.25, Enum.EasingStyle.Linear)
local MoveTo = TweenService:Create(Root, MoveToInfo, {CFrame = CFrame.new(Waypoint.Position)})
MoveTo:Play()
MoveTo.Completed:Wait()
local Rotate = TweenService:Create(Root, RotateInfo, {CFrame = CFrame.Angles(math.rad(Waypoint.Orientation.X), math.rad(Waypoint.Orientation.Y), math.rad(Waypoint.Orientation.Z))})
Rotate:Play()
end
----
Video:
(the video is short because devforum doesn’t support larger videos)
what I am trying to do is that the red dude when he reaches the waypoint (when the tween is completed) rotate to the direction the waypoint is, but still moving, just rotate
Why did you put waypoint.Orientation in CFrame.Angles? It doesnt’t rotate the root part properly. Try to put CFrame = waypoint.CFrame in Rotate Goal table.
The character still doesn’t rotate.
I put the orientation in cframe.angles because I want it to rotate in 0.25 seconds and if I put the position too, it won’t move while rotating
But I don’t want to add the :Wait() to the Rotate Tween because I don’t want it to stop for a short time when reaching a waypoint, I want it to be fluid, I’m doing a tower defense and I don’t want that to happen.
By the way, thank you very much for helping , I don’t want you to think that I’m not trying to solve it. I appreciate it