Click anywhere to play gui

for i = 1,4,1 do
	print("Text is changing")
		wait(.2)
		AddLoadScreen.Container.Loading.Text = "Loading." 
		wait(.2)
		AddLoadScreen.Container.Loading.Text = "Loading.." 
		wait(.2)
		AddLoadScreen.Container.Loading.Text = "Loading..." 
		wait(.2)
		wait(1)
	end
	
	wait(5)
	
	Fade.FadeOut(AddLoadScreen.Container.GameText, .5)
	Fade.FadeOut(AddLoadScreen.Container.Loading, .5)
	Fade.FadeOut(AddLoadScreen.Container.Background, .5)
	
	AddLoadScreen.Container.GameText.Visible = false
	AddLoadScreen.Container.Loading.Visible = false
	AddLoadScreen.Container.Background.Visible = false

This is what I got so for a loading screen pops up then I make it invisible. Then I want to make it where you click anywhere to play than everything goes invisible and the player allowed to enter the game. How would I be able to do this?

1 Like

You can use UserInputService to detect when the player clicks the left mouse button, then go from there.

Example:

local UIS = game:GetService("UserInputService")

for i = 1,4,1 do
	print("Text is changing")
		wait(.2)
		AddLoadScreen.Container.Loading.Text = "Loading." 
		wait(.2)
		AddLoadScreen.Container.Loading.Text = "Loading.." 
		wait(.2)
		AddLoadScreen.Container.Loading.Text = "Loading..." 
		wait(.2)
		wait(1)
	end
	
	UIS.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			Fade.FadeOut(AddLoadScreen.Container.GameText, .5)
			Fade.FadeOut(AddLoadScreen.Container.Loading, .5)
			Fade.FadeOut(AddLoadScreen.Container.Background, .5)
	
			AddLoadScreen.Container.GameText.Visible = false
			AddLoadScreen.Container.Loading.Visible = false
			AddLoadScreen.Container.Background.Visible = false
		end
	end)

Also, I would recommend replacing wait() with task.wait() for best optimization.

Let me know if this solved your problem!

Thanks,
Fizzitix

2 Likes

Yeah it worked thanks I appreciate you

3 Likes

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