Script doesnt work

function invisbile()
script.Parent.Transparency(0.5)

for i = 50,1,-1 do
script.Parent.SurfaceGui.TextLabel.Text = (“Intermission”…i)
wait(1)
if i == (40) then
invisible()
end
end
end

Can somebody help me to get this script working?

1 Like
function invisbile()
script.Parent.Transparency(0.5)

for i = 50,1,-1 do
script.Parent.SurfaceGui.TextLabel.Text = (“Intermission”…i)
wait(1)
if i < (40) then
invisible()
end
end
end

See if this works?

The script you gave me doesnt work.

First off, please format your code using 4 spaces before every line of code. (Must be 1 blank line away from non-formatted text.) Second off, are you getting any errors in the output?

Go here and read the text below this:

--As you can see, this is how you format code.--

What you mean use 4 spaces of line?

What does that mean? Give me a better example.

Explain what part of the script dosent work so people better than me can fix it

Try typing 4 spaces before your text and it will be formatted as Lua.

Extra information:

  1. The whole line must be formatted (so this: “text 4 spaces code” isn’t possible, while this: “4 spaces code” is)
  2. This won’t work if the line above or under the code is normal text,. (so this: “text enter 4 spaces code” isn’t possible, while this: “text enter enter 4 spaces code” is)

Example:

--This is a code block--

• Where is end after invisible function?
• Try to use tabs/4 spaces if you use loop or if/else.
• Provide the error message if it 1st didn’t fix the code

Claiming something “doesn’t work” is not helpful if you want it to ever get fixed. Does it throw any errors?

function invisible()

script.Parent.Transparency(0.5)

for i = 50,1,-1 do

script.Parent.SurfaceGui.TextLabel.Text = ("Intermission"…i)

wait(1)

if i == (40) then

invisible()

end

15:31:59.286 Workspace.Sign.Script:5: Expected ‘)’ (to close ‘(’ at column 43), got Unicode character U+2026 (did you mean ‘…’?) -

You’re missing a couple of ends there. You need them to

  1. Close a function
  2. Close a loop

Try adding the end to the Invisible() function in order to close it. What you’re currently doing is calling the function within itself.

function invisible()

script.Parent.Transparency(0.5)

end

Like this?

2 Likes
if code == 'NORMAL CODE' then
    print('here are FOUR spaces or one tab')
else
    print("Use tabs or it's impossible to read where if, else, while, for, function and etc. ends")
end

You only need two dots there to add something to a string if that’s what you want to do.

function invisible()

script.Parent.Anchored = false

end

for i = 50,1,-1 do

script.Parent.SurfaceGui.TextLabel.Text = ("Intermission"..i)

wait(1)

end

if i == (40) then

invisible()

end

The countdown now works, but it doesnt unachor itself when it hits 40.

The loop is still running when it reaches 40. To fix this, put the if statement inside of the loop.

function invisible()

script.Parent.Anchored = false

end

 for i = 50,1,-1 do

script.Parent.SurfaceGui.TextLabel.Text = ("Intermission"..i)

wait(1)

if i == 40 then

invisible()

end

end

Still doesnt work.

I think the problem is that the game thinks the function is the entire script, you’re gonna want to seperate all the end’s as I’m assuming your function is only script.Parent.Transparency(0.5), so you have to add an end after the function

function invisbile()
    script.Parent.Transparency(0.5)
end
for i = 50,1,-1 do
    script.Parent.SurfaceGui.TextLabel.Text = (“Intermission”…i)
end
wait(1)
    if i == (40) then
invisible()
end

(also please use the correct formatting as well as indentations, they make the script look so much cleaner and easy to understand)