Hey how do I make a GUI that disables a script when it is clicked/tapped? I really need this for a game called Bones.
https://developer.roblox.com/en-us/api-reference/event/GuiButton/MouseButton1Click
Along script.Disabled
Local Button = --Where ever your button is
Local Script = --Where ever the script is
Button.MouseButton1Up:Connect(function()
Script.Disabled = true
Let me know if anything’s wrong with it
Ok thanks. I needed this ill try it
Fix your code, it doesnt have an end)
at the end.
Hey I need to keep the blood script in workspace or it doesn’t work and I don’t know how to make the GUI find the script to disable.it.
Hey I need to keep the blood script in workspace or it doesn’t work and I don’t know how to make the GUI find the script to disable it when the button is pressed.
Just enable it later using something like the script below.
local script = game.Workspace.ScriptNameGoesHere
script.Enabled = true
or if you want to enable it with another button, place this inside a LocalScript, and that LocalScript must be inside the button.
local button = script.Parent
local script = game.Workspace.ScriptNameGoesHere
button.MouseButton1Click:Connect(function()
script.Parent.Enabled = true
end)
make a buttonGUI with a function inside it along with Script.Disabled = false
. then you’d have to write some more code to change Script.Disabled = false
to Script.Disabled = true
I can’t write the code for you but I wish you good luck with it
Thanks so much
ill try it out.
Hey what did I do wrong here the Localscript inside the GUI is this script: local button = script.Parent
local script = game.Workspace.ScriptNameGoesHere
button.MouseButton1Click:Connect(function()
script.Parent.Enabled = true
end) Script.
Oh, you forgot to change the “ScriptNameGoesHere”.
the correct code for this case would be
local script = game.Workspace.Advancedblood
local button = script.Parent
button.MouseButton1Click:Connect(function()
script.Parent.Enabled = true
end)
I did change the ScriptNameGoesHere to Advancedblood I just didn’t include it in the reply
Oh ok, use this instead.
local script = game.Workspace.Advancedblood
local button = script.Parent
button.MouseButton1Click:Connect(function()
script.Parent.Enabled = true
end)
I forgot to add the button
variable.
Ok thanks ill try it out for my game
I tried it and it still doesn’t work.
Can I see the output in your game?
Yes I will show you the outputs.
local ScriptToRemove = game.Workspace.Advancedblood
local button = script.Parent
button.MouseButton1Click:Connect(function()
ScriptToRemove.Disabled = true
end)
Maybe this? Script as the variable wouldn’t work.
I think the solution would be this @RedstoneExpert6
local s = game.Workspace.Advancedblood
local button = script.Parent
button.MouseButton1Click:Connect(function()
s.Disabled = false
end)
Script can’t be the name of a variable.