Invalid number of arguments while doing CFrame

So I was trying to make a CFrame, and got this error:

Invalid number of arguments: 4 - Server - Script:8

Here is my script:

local startPosition = game.Workspace.StartPosition
local Block = script.Parent
local Position1 = game.Workspace.Position1
local lastPosition = game.Workspace.LastPosition

while true do
	wait(10)
	Block.CFrame = CFrame.new(startPosition.Position,Position1.Position,lastPosition.Position,Position1.Position)
	wait(5)
end

Have a Great day!
ParkCityUSA

1 Like

Additional info: I put the script in a server script inside of the part “Block.”

i was pretty confused with what you were trying to achieve, but from the code you provided it seemed like you were trying to make a block go back and fourth. the thing you did wrong was put in several positions in one place. here’s the fixed script:

local startPosition = game.Workspace.StartPosition
local Block = script.Parent
local Position1 = game.Workspace.Position1
local lastPosition = game.Workspace.LastPosition

while true do
	wait(10)
	Block.Position = Vector3.new(startPosition.Position)
	wait(1) -- put in the time you want to wait for the block to move
	Block.Position = Vector3.new(Position1.Position)
	wait(1) -- put in the time you want to wait for the block to move
	Block.Position = Vector3.new(lastPosition.Position)
	wait(1) -- put in the time you want to wait for the block to move
	Block.Position = Vector3.new(Position1.Position)
	wait(5)
end
2 Likes

What are you trying to achieve?

This is what I get:

I don’t know what happens, it just moves there.

what are you trying to achieve though

Your post really doesn’t give any proper information, all you’re saying is “Trying to make a CFrame” which doesn’t make any sense to me. If you just want the problem to be solved, then its just that you passed on 4 arguments to CFrame.new()

I want to make a part move to another invisible part using cframe.

If you want to move it from Position 1 to 2, in a really smooth manner, then use TweenService.

could you show us which part exactly? (show the name of the parts on the explorer page)

Instead of doing position do CFrame so
while true do
wait(10)
Block.CFrame = CFrame.new(startPosition.CFrame,Position1.CFrame,lastPosition.CFrame,Position1.CFrame)
wait(5)
end