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

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

Asked by 5 years ago
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

Log in to vote
0
Answered by 5 years ago

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!

Ad

Answer this question