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

Is it possible for a click button on a screen/surface gui to enable/disable a certain script?

E.g Click surface GUI with a question such as "Do you want to pick this character?"----> click on a "yes" button---->Interface on surface says "are you sure?", if player then click "yes" again, enable a script/ disable a certain script via script name. If "no", go back to "Do you want to pick this character?".

I'll go right ahead and say, i'm not very experienced at all in making scripts from scratch on ROBLOX, I only know some of the basic terminology (but even then, I don't know which terminology are really coined as "basic" so you can see my struggle here.) I only really edit pre-built scripts to suit what i'm trying to make. I'm more of a builder than a scripter.

I've tried various methods to create this, but none have worked so far. Help would be much appreciated and I'll be sure to credit you if you can help me find a working solution. :)

1 answer

✓ Accepted answer

Yes It is possible to enable a script through a gui, first you need the function to call.

function onButtonClicked()

end
script.Parent.MouseButton1Down:connect(onButtonClicked)

And then you need to locate the script you want to disable/enable

local script1 = workspace.script1 -- Put location of your script you want to enable/disable
function onButtonClicked()

end
script.Parent.MouseButton1Down:connect(onButtonClicked)

Finally, enabling the script

local script1 = workspace.script1 -- Put location of your script you want to enable/disable
function onButtonClicked()
script1.Disabled = false
end
script.Parent.MouseButton1Down:connect(onButtonClicked)

Hope this helped, if you have problems leave a comment, and if this did help please accept as answer

6 comments

0

Wow, thanks for the quick reply! Your suggestion seems like it should work, but somehow it doesn't :(. Do I need to change "script1" to the name of the script i want to enable e.g say if my script i wanted to enable was called "cheese" then: local script1 = workspace.cheese do you think that might make this work?

0

Yes change script 1 to the script you want, that is correct

0

Tried implementing this but for some reason it still won't work. Is it okay if I send the model with the script I want to enable to you, then you send it back to me with the working gui + script? Because i'm pretty sure your solution is valid, it's just that i'm goofing it up when i'm trying to implement it

0

Make sure you have this inside of a textbutton or imagebutton, and that the script your enabling is in workspace

0

Ah! Thankyou, everything with the script you've provided is okay now, cheeers :D

0

please accept it as an answer :D GLAD I COULD HELP

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