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

Help me with my script please?

Asked by
steev 0
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
0
Answered by
Relatch 550 Moderation Voter
9 years ago
for i = 60, 0, -1 do
    script.Parent.Text = "You cannot use this gui for another " ..i.. " seconds"
end
Ad
Log in to vote
-1
Answered by 9 years ago

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.

Answer this question