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

I don't know how to get this disabled global script to run once enabled?

So I'm trying to get a global script to activate, so i made a local script enable the script when the gui button is pressed.

function leftClick(mouse)
	print ("Earth Element Clicked")
	script.AddStuffScript.Disabled = false
end
script.Parent.MouseButton1Click:connect(leftClick)

this script prints that the gui button (earth element) is clicked, then it enables the global script.


while true do	
	print("Earth Script Activated")
	game.Players.LocalPlayer.Character.Band.Handle.Transparency = 0
	game.Players.LocalPlayer.Character.UserSettings.Element.Value = "Earth"
	game.Players.LocalPlayer.Character.Band.Handle.BrickColor = BrickColor.new("Bronze")
	script.Disabled = true
end

this is the global script its not running when enabled, can someone help?

And yes everything is int he right place and named correctly, no errors in the output are showing! Also I know the stuff inside the global script is incorrect! i just need the print messgae to appear!

2 comments

0

when you say "global script" do you mean server script? the little light blue script

0

yes

1 answer

You can't disable server scripts with local scripts. Try firing an event to another server script to disable this. However, this is really exploitable so it's best if you try find another way of doing it instead of disabling it. And if you only need it to run once, you don't need to put it in a loop and then disable it. You can either break the loop, remove the loop or destroy the script.

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