Heres the code for it.
button = script.Parent.Parent.Parent
window = button.Parent.Parent.Parent
function onClicked(GUI)
window:remove()
end
script.Parent.MouseButton1Click:connect(onClicked)
Heres the code for it.
button = script.Parent.Parent.Parent
window = button.Parent.Parent.Parent
function onClicked(GUI)
window:remove()
end
script.Parent.MouseButton1Click:connect(onClicked)
I highly recommend you use a for loop instead as it is much shorter and looks much cleaner in your code.
button = script.Parent.Parent.Parent
window = button.Parent.Parent.Parent
function onClicked()
for i = 1, 0, -.05 do
window.BackgroundTransparency = i
wait()
end
window:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked)
If your window is an image, use ImageTransparency as well.
button = script.Parent.Parent.Parent
window = button.Parent.Parent.Parent
function onClicked()
for i = 1, 0, -.05 do
window.BackgroundTransparency = i
window.ImageTransparency = i
wait()
end
window:Destroy()
end
script.Parent.MouseButton1Click:connect(onClicked)
You should always ensure that you use :Destroy() instead of :remove() as remove is deprecated and doesn't completely "remove" objects. If there are children to the window that also fade away, you will also need to refer to those in the script. I hope this helped!
button = script.Parent.Parent.Parent
window = button.Parent.Parent.Parent
function onClicked()
window.BackgroundTransparency = 0.9
wait(0.1)
window.BackgroundTransparency = 0.8
wait(0.1)
window.BackgroundTransparency = 0.7
wait(0.1)
window.BackgroundTransparency = 0.6
wait(0.1)
window.BackgroundTransparency = 0.5
wait(0.1)
window.BackgroundTransparency = 0.4
wait(0.1)
window.BackgroundTransparency = 0.3
wait(0.1)
window.BackgroundTransparency = 0.2
wait(0.1)
window.BackgroundTransparency = 0.1
wait(0.1)
window.BackgroundTransparency = 0
end
script.Parent.MouseButton1Click:connect(onClicked)
try that
This discussion is preserved as it was. New answers, comments, and votes are closed.