Alright, so i made a script for my Menu_Gui, which is you know. The options to Play, Customize Character Looks, and Look at Options to change gameplay experience, etc.
When someone clicks "Play", it brings up a notification i made. That let's them know they will be locked into first person. That once clicking "OK" they will be locked into first person.
This is the script for the button i made. If you're wondering why i did all the transparency, and didn't use a variable, and didn't just use *1. I was bored. I felt like typing each line with transparency change.
function onClicked()
game.Players.LocalPlayer.CameraMode = "LockFirstPerson"
print("FirstPersonisLocked")
script.Parent.Parent.Parent.BackgroundTransparency = 0
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.1
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.2
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.3
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.4
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.5
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.6
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.7
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.8
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 0.9
wait(0.1)
script.Parent.Parent.Parent.BackgroundTransparency = 1
wait(0.1)
script.Parent.Parent.Parent.Parent:remove()
print("everything removed")
end
script.Parent.MouseButton1Click:connect(onClicked)
Is there a way i could make this be only allowed to be pressed once? Because if i press the button multiple times. It makes this flicker affect, because every time i click it, it's restarting this whole function and script itself. Is there a way i can make it where once you click it, the script works, and then you're not able to keep clicking this button.
Thanks in advanced if you answer!

5 comments
I wasn't asking for simplified code. I made my code like that, because i was bored and i felt like doing all that. I can work my games scripts how i would like, but thank you. I'd rather get an answer pertaining to my question i asked. Thanks though!
I also answered it while simplifying
its answered try it out. before you start lowering peoples points.
I actually didn't down your reputation. Talk to someone else about that, i never vote up/down on reps. But thanks for the response.
honestly i was speaking in general shouldve mentioned that