I’m creating a sleigh to fly around my map, but when trying to use math.floor it gives me this error:
Workspace.Att.Sleigh:15: invalid argument #1 to 'floor' (number expected, got Vector3)
Code:
local TweenService = game:GetService("TweenService")
local timea = time()
local total = 20
while true do
local att = 1
local model = workspace.Sleigh
local start = model:GetPrimaryPartCFrame()
while time() - timea <= total do
local End = game.Workspace.Att["Attachment"..att].WorldCFrame
local TI = TweenService:GetValue((time() - timea)/total, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local CFrame2 = start:Lerp(End,TI)
model:SetPrimaryPartCFrame(CFrame2)
model:SetPrimaryPartCFrame(CFrame.lookAt(model.PrimaryPart.Position, script.Parent.Attachment1.WorldPosition))
if math.floor(model.PrimaryPart.CFrame.Position-game.Workspace.Att["Attachment"..att].WorldCFrame.Position) == 0 then
att = att + 1
local total = 20
local timea = time()
end
wait()
end
end```