Ad
Log in to vote
0

End expected to close ' for' at line 3?

Asked by 7 years ago

In the output I keep getting Workspace.Part.SurfaceGui.TextButton.Script:12: 'end' expected (to close 'for' at line 3) near 'for'

b = script.Parent
b.MouseButton1Click:connect(function()
for n = 0,1,0.1 do
            wait(0.1)
    b.BackgroundTransparency =n
    b.TextTransparency = n
    break   
--  if b.BackgroundTransparency ==0
--      and b.TextTransparency ==0
--      then 
--wait(5)
        for i = 1,0,-0.1 do
    wait(0.1)
    b.BackgroundTransparency =i
    b.TextTransparency = i
    break
        end
        end
end)

2 answers

Log in to vote
1
Answered by
KAAK82 16
7 years ago

if the sytsem tells u close it, then close it... that's the thing I'd actually recommend most, Listen to the Output

b = script.Parent
b.MouseButton1Click:connect(function()
for n = 0,1,0.1 do
            wait(0.1)
    b.BackgroundTransparency =n
    b.TextTransparency = n
    break   
--  if b.BackgroundTransparency ==0
--      and b.TextTransparency ==0
--      then 
--wait(5)
end --closes 'for' above, loops need an end just like functions and if's
        for i = 1,0,-0.1 do
    wait(0.1)
    b.BackgroundTransparency =i
    b.TextTransparency = i
    break
        end
        end
end)

0
Also, if u ever need to kno ho to put a function under another function, then u'll find the Anser in the 'end's KAAK82 16 — 7y
Ad
Log in to vote
2
Answered by
HexC3D 830 Moderation Voter
7 years ago

Workspace.Part.SurfaceGui.TextButton.Script:12: 'end' expected (to close 'for' at line 3) near 'for' In other words you forgot an end it happens to me a lot.

    for i= 1,1,0.1 do
      -- code
 end 

Answer this question