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

Why is there a red line at the bottom of this script?

Asked by 5 years ago
Edited by DeceptiveCaster 5 years ago
part = game.Workspace.Part

while true do

    local Newpos = pos

    wait(5)

    part.BrickColor = BrickColor.new("Maroon")

    pos = math.random(1,4) -- picks a number for pos

    if pos == 1 then --this makes decisions to where it teleports

        part.Position = game.Workspace.Start.Position

        part.BrickColor = BrickColor.new("Persimmon")

    elseif pos == 2 then

        part.Position = game.Workspace.Start2.Position

        part.BrickColor = BrickColor.new("Persimmon")

    elseif pos == 3 then

        part.Position = game.Workspace.Start3.Position

        part.BrickColor = BrickColor.new("Persimmon")

    elseif pos ==4 then

        part.Position = game.Workspace.Start4.Position

        part.BrickColor = BrickColor.new("Persimmon")

    end
--end is underlined with red I cant figure out why and it is breaking my script
0
Just hover over the word that the line is under The_Pr0fessor 595 — 5y
0
it should tell you The_Pr0fessor 595 — 5y
0
I cant understand it it says "Expected 'end' ('to close 'then' at line 18), got <eof> 50ShadesofLamps 5 — 5y
0
There should be 2 ends Clasterboy 72 — 5y
View all comments (3 more)
0
You forgot to close off the "then" at line 18. When it shows "Expected 'end'" (Happens a lot) then just add another end. Good luck! Doglord120 0 — 5y
0
You should add another "end" to the script. At line 2 you start a "while true do" that you end at line 19 (last line), but at line 7 you start a "if" that you never end. Spjureeedd 385 — 5y
0
I put the code into a code block. DeceptiveCaster 3761 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You forgot to put another end at the end xD Here's the fixed code ;)

part = game.Workspace.Part



while true do



local Newpos = pos



wait(5)



part.BrickColor = BrickColor.new("Maroon")



pos = math.random(1,4)



if pos == 1 then



part.Position = game.Workspace.Start.Position



part.BrickColor = BrickColor.new("Persimmon")



elseif pos == 2 then



part.Position = game.Workspace.Start2.Position



part.BrickColor = BrickColor.new("Persimmon")



elseif pos == 3 then



part.Position = game.Workspace.Start3.Position



part.BrickColor = BrickColor.new("Persimmon")



elseif pos == 4 then



part.Position = game.Workspace.Start4.Position



part.BrickColor = BrickColor.new("Persimmon")



end

end
Ad

Answer this question