Bezier Curve Humanoid Tween

So, I am making a tds game and I want the smooth 90 degree turn around “waypoints” on the path, like how TDS X does it
My pretty simple system works by going through the folder’s Children by numerical order in their names, I have tried doing that for the bezier curve but it didn’t go so well.
Please note that I don’t have much knowledge of bezier curves.

Enemy Script:

local Tween = game:GetService("TweenService")
local enemy = workspace.Model
local Path = workspace.Map.Movement
local Spawn = workspace.Map.Movement.Spawn

local speed = 8
local rotspeed = 1

function SpawnEnemy()
	local entity = enemy:Clone()
	entity.HumanoidRootPart.CFrame = Spawn.CFrame
	entity.Parent = workspace

function MoveEnemy(entity)
	for waypoint=1, #Path:GetChildren() do
		local Walking = Tween:Create(entity.HumanoidRootPart, - Path[waypoint].Position).Magnitude/speed, Enum.EasingStyle.Linear, Enum.EasingDirection.In), {CFrame = Path[waypoint].CFrame})

while true do

Bezier Script:

function lerp(a, b, c)
	return a + (b - a) * c

function quadBezier(t, p0, p1, p2)
	local l1 = lerp(p0, p1, t)
	local l2 = lerp(p1, p2, t)
	local quad = lerp(l1, l2, t)
	return quad

local PointA = workspace.Map.Movement[1]
local PointB = workspace.Map.Movement[2]
local PointC = workspace.Map.Movement[3]

for i=0, 1, .1 do
	for j=1,10 do
		local part ="Part")
		part.Anchored = true
		part.Name = ""..tostring(j)
		part.Transparency = 0
		part.Color = Color3.fromRGB(255, 191, 0)
		part.Size =,.5,.5)
		part.CFrame =, PointA.Position, PointB.Position, PointC.Position))
		part.Parent = workspace.Map.Movement


the bezier script is based on this video

Help would be appreciated
And also note that my knowledge in lua is not great, more less Roblox’s LuaU, but it has been easy going with my knowledge in c++ and java

I believe TD X uses some hacky maths to have smooth turns. The programmer Atrazine who works for TD X has said that he had used maths to make it turn smoothly. Though I’m not too sure what maths you could use instead of bezier.

For more advanced methods I suggest you could Hermite Splines which are a bit similar to bezier.

though, this is a necropost, thanks for it anyway!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.