Im trying to work with moving a vehicle. Im not looking into Motor6D's right now, im just fiddling with some stuff on my own. Im trying to see if I can execute this while loop function at the same time as another, and for that im trying to use the "spawn()" function. However, I always get the error, "Spawn function requires 1 argument." Here is my code:
local MoveVehicle = function(MoveTo) local TweenProperties = { CFrame = Vehicle.CFrame * MoveTo } local Tween = TweenService:Create(Vehicle,TweenInfo,TweenProperties) Tween:Play() CurrentTween = Tween end spawn(MoveVehicle(CFrame.new(0,0,-100)))
There is much more, but these are the only relevant sections. As far as I can tell im passing the Function "MoveVehicle" as the argument for the built-in function "spawn", so I honestly have no clue whats happening here.
That is passing in more than 1 argument. Use this code instead of line 10
spawn(function() MoveVehicle(CFrame.new(0,0,-100)) end)
This spawns a function with 1 argument that then runs another function with a CFrame argument rather than trying to pass two arguments into a spawn function.