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

How do you disable a button for all players on a server?

Hi! I have been trying to code a button so that when it is pressed, it disappears off the screen, while the GUI is still enabled, for all the players on the server. Here is my code. (I'm only a beginner, so help is greatly appreciated!)

This script is a child of the button.

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.DisableGUI = true
	script.Parent.Active = false
end)

1 answer

I'm assuming that you just want the ClickDetector gone?

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.DisableGUI = true
    script.Parent:Destroy()
end)

This will delete the ClickDetector completely if you want to have it so you could reenable it you could go multiply ways of doing so. If you wanted the ClickDetector gone completely and then readded you could always have the script located somewhere else and checking when it's not nil and nil. Otherwise, you could also disable the script. With a second script. ( I know there is probably better ways of doing this )

2 comments

0

I just now tried this and it didn't work. I have two different accounts testing the game and when I clicked the button on one of them, the other still could click the button. :/

0

Is your script local?

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