Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Got this error [ Expected identifier when parsing expression, got 'for'] can anyone help me fix it?

Asked by
Nump4d 5
4 years ago
local run = false

while wait() do

if run == true then 
    return

for i= 1, 300 do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,2)
    wait()
    end

for i= 1, 300 do
    script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,-2)
    wait()
    wait(2)
    end

    script.Parent.CFrame = game.Workspace.SubPos1.CFrame
    run = true





This is a script for a car that goes down a track, i'm trying to make it to where when it reaches 'run = true' at the bottom that it repeats the action again.

0
Could you show the full output? raid6n 2196 — 4y

1 answer

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago

Unfortunately, there is not much I can help you with as you didn’t show the full output. I recommend using the site https://developer.roblox.com/en-us/articles/Roblox-Coding-Basics-Loops

0
Here is the full output, sorry about that [ Workspace.Moving brick.Script:8: Expected identifier when parsing expression, got 'for'] Nump4d 5 — 4y
0
Change line 8 to for i= 1,300 do raid6n 2196 — 4y
Ad

Answer this question