i am new to scripting and i was following a tutorial and i am pretty sure i did what he said but i can't seem to get it working, could anyone please help me figure out what is wrong with this?
function lerp(a, b, c)
return a + (b - a) * c
end
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
end
local TweenService = game:GetService("TweenService")
local PointA = workspace.PointA
local PointB = workspace.PointB
local PointC = workspace.PointC
while true do
local Folder = Instance.new("Folder")
Folder.Parent = workspace
local part = Instance.new("Part")
part.Anchored = true
part.Shape = "Ball"
part.Color = Color3.fromRGB(255, 192, 1)
part.Position = PointA.Position
part.Size = Vector3.new(2, 2, 2)
part.Material = "Neon"
part.Parent = Folder
task.wait(1)
local numberValue = Instance.new("NumberValue")
numberValue.Parent = Folder
local connection
connection = numberValue.Changed:Connect(function()
part.CFrame = CFrame.new(quadBezier(numberValue.Value, PointA.Position, PointB.Position, PointC.Position))
TweenService:Create(numberValue, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Value = 1}):Play()
task.wait(1)
if connection then
connection:Disconnect()
end
Folder:Destroy()
end)
end
** You are now Level 2! **