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

What is wrong with this code? It says 'eof' expected near 'end'

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

foreverloop()

wait(1)

Script.Parent.CanCollide = false

Script.Parent.Transparency = 0.5

wait(1)

Script.Parent.CanCollide = true

Script.Parent.Transparency = 0

end

0
That goes up and down militaryiscool 0 — 10y
3
Edit your post to use Lua code formatting, and also maybe describe the problem a little more. BlueTaslem 18071 — 10y
0
Well It says Eof expected near end when I put end militaryiscool 0 — 10y

3 answers

Log in to vote
0
Answered by 10 years ago

<eof> is fine it means the engine is running correctly. and if you want to check your script, right click and go down and click "Check Script" and It will auto go to the Error. if it wont let you then you dont have a Error

0
If it has <Eof> ('end' Expected near "then") = put a end :P jillmiles1 3 — 10y
Ad
Log in to vote
0
Answered by
Legojoker 345 Moderation Voter
10 years ago

There is no method named foreverloop(). A computer has no idea what this means, code must obey certain rules. The code below should work. Keep in mind while is accepted by lua as a loop that continues until the conditions between it and "do" are met, if you put true in the middle it will repeat forever unless something inside of it commands it to break.

while true do
    wait(1)
    script.Parent.CanCollide = false
    script.Parent.Transparency = 0.5
    wait(1)
    script.Parent.CanCollide = true
    script.Parent.Transparency = 0
end

PS: Don't capitalize Script when referring to the script the code is in.

Log in to vote
0
Answered by 10 years ago

Try this.

i = s
while i=s do
wait(1)
Script.Parent.CanCollide = false
Script.Parent.Transparency = 0.5
wait(1)
Script.Parent.CanCollide = true
Script.Parent.Transparency = 0

end

Answer this question