Cooldown with text Popup (Please wait 5 seconds...)

Yeah sorry I kind of did not understood how oldpopup and newpopup thing is going to work

1 Like

It’s the location of the new pop up. But it kind of sounds like your code didn’t make one.

1 Like

Hmm so what should I do? I am still a bit confused with that part. Will try without tween till you reply

1 Like

I’m confused as well. What is the pop up for your GUI?

1 Like

lets forget about tween part for now and can you help me with detecting 2 clicks?
like I want that pop up to happen after the user clicks the button more than once.

You can use Button.Activated (for your button) and the parameter tells us how many clicks it has:

button.Activated:Connect(function(_,clicks)
if clicks < 2 then
return
end
end)

You could do this
‘’‘Lua
Local Debounce = true
Button.Activated:Connect(function()
If Debounce == True then
–teleport the player
Wait(5)
Else
–open the wait 5 seconts thingy
‘’’

Hi there. You can copy and paste this and adjust it however you need to do so!

local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local TeleportPoint = workspace.TeleportPart
local Client = Players.LocalPlayer
local Active = false
local ShouldCountDown = false
local TextLabel = script.Parent -- Change this to whatever you need.
local RunFunction

function Countdown(Time, Text)
	RunFunction = RunService.Heartbeat:Connect(function(DT)
		if ShouldCountDown == false then
			ShouldCountDown = true
			task.wait(1)
			Time -= 1
			ShouldCountDown = false
			if Time <= 0 then -- If there are any bugs that caused the countdown to go past 0 which means it'd be -1, then the code will stop instead of being permanently stopped because it hit -1.
				Active = false
				Text.TextTransparency = 1
				Text.TextStrokeTransparency = 1
				--	Text.BackgroundTransparency = 1 -- Remove the dashes that come before "Text.BackgroundTransparency" to make this transparent too.
				RunFunction:Disconnect() -- Disconnects the event so it will not continue running in the background.
			end
		end
	end)
end

local function TweenText(Text, TimeLeft)
	Text.Text = "Please wait "..tostring(TimeLeft).." seconds..."
	local Info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false) -- Change false to true if you'd like it to go away right after appearing.
	local Goal = {}
	Goal.TextTransparency = 0
	Goal.TextStrokeTransparency = 0
	--	Goal.BackgroundTransparency = 0 -- Remove the dashes that come before "Goal.BackgroundTransparency" to apply this to the goal.
	local Tween = TweenService:Create(Text, Info, Goal)
	Tween:Play()
	Tween.Completed:Connect(function()
		task.wait(0.5) -- Adding "TweenInfo.new(1)" with task.wait(4) = 5. Which means a five second wait. Remove this line if you want.
		Countdown(5) -- Starts the countdown function.
	end)
end

script.Parent.MouseButton1Click:Connect(function()
	if Active == false then
		Active = true
		if not game.Workspace:FindFirstChild(Client.Name) then
			return -- Stops the code from proceeding if the player's character does not exist.
		end
		local Info = TweenService
		local RootPart = Client.Character:FindFirstChild("HumanoidRootPart")
		if RootPart then
			RootPart.CFrame = CFrame.new(TeleportPoint.CFrame.Position + Vector3.new(0, 5, 0))
			TweenText(TextLabel)
		end
	end
end)
1 Like

Alright replace this with: – Trainmaster2341 had it right
– put a local on top (out of function)
local db = false

if db == false then
db = true
textlabel.Visible = true
for i = 5,0,-1 do
	textlabel.Text = "Please wait "..i.." seconds"
	task.wait(1)
	if i == 5 then
		textlabel.Visible = false
	end
end 
db = false
end

Mate this is insane script, not just you helped me but I got to learn alot of things as well. Thank you so much mate :))

And yeah theres a new post.
I really need help with Player Gui saving script > Save Gui (Button Color) & (Image)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.