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

Help me with my script please?

I got this script now all i need is a 60 second timer for example, once the GUI is clicked it can't be used for another 60 seconds. I also need help on getting the player to know how many seconds they have until they want to click the GUI again.

script.Parent.MouseButton1Click:connect(function()
c = game.Lighting["Horse"]:Clone() 
c.Parent = game.Workspace
c:MoveTo(script.Parent.Parent.Parent.Parent.Character.Torso.Position + Vector3.new(0,0,10))
end)

Thank you.

2 answers

for i = 60, 0, -1 do
	script.Parent.Text = "You cannot use this gui for another " ..i.. " seconds"
end

Easy, but time consuming. First, add a new script in your current script. Then create an IntValue in the new script, then create a variable for the value of the IntValue, like this (It is reccomended that you rename your new script):

e = script.IntValue -- For new script

Add this at the top of your first script:

c = script.script.IntValue -- For old script

Add this into your function in the first script:

c.Value = 2  -- 2 = can't use

Next add an if to your new script:

if e.Value == 2 then
script.Parent.Disabled = true
wait(60)
script.Parent.Disabled = false
e.Value = 1
end

The countdown is easy, too. It will just take to long for me to do. So, just get your GUI/Whatever it is that tells you how much it has left, and add a TextLabel/TextBox. Change the wait(60) in the if to 5 or something and then do this repeated until you get to 0:

GUI.TextBox.Text = "60 seconds..."
wait(10)
GUI.TextBox.Text = "50 seconds..."
wait(10)
GUI.TextBox.Text = "40 seconds..."

That should work :) REMEMBER TO CHANGE THE NAMES OF THE SCRIPTS IN THE SCRIPT IF YOU CHANGE THEM.

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