Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Model won't move back and forth?

I want the model to move forward go back to start then repeat forever but it won't move at all and there are no errors

workspace.Road.PrimaryPart = workspace.Road.Center

while true do
	for i = 1,100 do
		wait(0.01)
		
		workspace.Road.SetPrimaryPartCFrame(CFrame.new(workspace.Road.PrimaryPart.Position + Vector3.new(0,0,1)))
	end
	
	wait(0.01)
		for i = 1,1 do
		wait(0.01)
	
		workspace.Road.SetPrimaryPartCFrame(CFrame.new(workspace.Road.PrimaryPart.Position - Vector3.new(0,0,100)))	 

	end
	wait(0.01)
end

2 comments

0

Do they stay at the same position or you can't see them?

0

It stays in the same spot

2 answers

✓ Accepted answer

The problem is you're using .SetPrimaryPartCFrame, while the correct way is using ":" just like so :SetPrimaryPartCFrame. So here is how the script is:

workspace.Road.PrimaryPart = workspace.Road.Center

while true do
    for i = 1,100 do
        wait(0.01)

        workspace.Road:SetPrimaryPartCFrame(CFrame.new(workspace.Road.PrimaryPart.Position + Vector3.new(0,0,1)))
    end

    wait(0.01)
        for i = 1,1 do
        wait(0.01)

        workspace.Road:SetPrimaryPartCFrame(CFrame.new(workspace.Road.PrimaryPart.Position - Vector3.new(0,0,100)))  

    end
    wait(0.01)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.