Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make it so when I click a TextButton it plays this script?

for i=0, 1, .01 do
    ui.Transparency=i
    wait()
end

Please explain me how to write the code or give me the code.

1 answer

✓ Accepted answer

You aren't looking for a click, you have to use a connect to do this:

script.Parent.MouseButton1Click:connect(function()
     for i=0, 1, .01 do
       ui.Transparency=i
      wait()
end
end)

This is what I changed:

script.Parent.MouseButton1Click:connect(function()
 -- code here
end)

you can also use this:

function onClicked()

end

script.Parent.MouseButton1Click:connect(onClicked) -- what the function is named

Hope this helped. Enjoy!

This discussion is preserved as it was. New answers, comments, and votes are closed.