How to repeat the script when you click again

How can I do when clicking the button again in the GUI so that the script repeats from the beginning

1 Like

What is the script like? We need the script or else we can’t help you

Put everything you need in a function, when the button is clicked, call the function again perhaps?

1 Like

False - of course we can help the OP.

We can give a step or steps necessary to completing this, much like @IAmTailerr has.

1 Like

You would only need something like:

local UIS = game:GetService(“UserInputService”)

local function onButton1Down(input, processed)
    if processed then return end
    else if input == Enum.KeyCode.MouseButton1Down then
        print(“Baller”)
    end
end

UIS.MouseButton1Down:Connect(onButton1Down)

If I’m not wrong

We has two scripts,
This is one: (This is enable loading bar)
this are need repeat

script.Parent.LoadingBarWhite:TweenSize(UDim2.new(1,0,1,0),"In","Linear",10,true)
wait(10)
script.Parent.Parent.Text.Text = "Loading Assets..."
wait(1)
script.Parent.Parent.Parent.Parent.Transition.Position = UDim2.new(1,0,0,0)
script.Parent.Parent.Parent.Parent.Transition:TweenPosition(UDim2.new(0,0,0,0),"In","Linear",0.25,true)
wait(0.25)
script.Parent.Parent.Parent.Parent.Transition:TweenPosition(UDim2.new(-1,0,0,0),"In","Linear",0.25,true)
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
script.Parent.Parent.Parent.Parent.Loading.Visible = false
wait(0.25)
script.Parent.Parent.Parent.Parent.CurrentVersion.Visible = false

and one other

(this are not need repeat this is TextButton script, that make enable of LoadingBar script, loading bar, but we need repeat loading bar with using this script?)

local TweenService = game:GetService("TweenService")
local TweenSpeed = 0.1
local Info = TweenInfo.new(TweenSpeed, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0)
-- Gui
local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
local Player =  Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local Menu = PlayerGui:WaitForChild("Menu")
local MainFrame = Menu:WaitForChild("MainFrame")
local Popups = MainFrame:WaitForChild("Popups")
-- Camera
local transition = MainFrame:WaitForChild("Transition")
local Camera = workspace.CurrentCamera
-- frame
local frame = script.Parent.Parent.Team1

-- Gui
script.Parent.Parent.Team1.MouseButton1Click:Connect(function()
	Popups.TeamSwitch.Visible = false
	transition.Position = UDim2.new(1,0,0,0)
	transition:TweenPosition(UDim2.new(0,0,0,0), "Out","Linear",0.25,true)
	wait(0.25)
	Camera.CFrame = workspace.Menu.Cameras.LoadingFace.CFrame
	transition:TweenPosition(UDim2.new(-1,0,0,0), "Out","Linear",0.25,true)
	MainFrame.Loading.Visible = true
	MainFrame.Loading.Loading.LoadingBar.LocalScript.Disabled = false
	wait(7.50)
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
	wait(1.50)
	PlayerGui.ShopFunction.Open.Visible = true
	PlayerGui.TeamSwitch.Menu.Visible = true
end)

-- Buttons

script.Parent.MouseEnter:Connect(function()
	local Color = Color3.fromRGB(170, 170, 255)
	TweenService:Create(frame, Info, {BackgroundColor3 = Color}):Play()
end)

script.Parent.MouseLeave:Connect(function()
	local ColorColor = Color3.fromRGB(34, 34, 34)
	TweenService:Create(frame, Info, {BackgroundColor3 = ColorColor}):Play()
end)

-- Text --

script.Parent.MouseEnter:Connect(function()
	local Color = Color3.fromRGB(255, 255, 255)
	TweenService:Create(script.Parent.Parent.Frame.TextLabel, Info, {TextColor3 = Color}):Play()
end)

script.Parent.MouseLeave:Connect(function()
	local ColorColor = Color3.fromRGB(255, 255, 255)
	TweenService:Create(script.Parent.Parent.Frame.TextLabel, Info, {TextColor3 = ColorColor}):Play()
end)

Put the first in a function and Conner the function to an event

If this is a loading screen, why not use ContentProvider to load assets?

I am find how i can make it, but thx for try help me

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