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

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago

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 )

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. :/ love_elizxbeth 0 — 3y
0
Is your script local? DogCooper 2 — 3y
Ad

Answer this question