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

Im trying to make a loading screen that you press a button to dismiss. But it wont work?

Here is my code so far set in a local script:

game.ReplicatedFirst:RemoveDefaultLoadingScreen()

local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
PlayerGui:SetTopbarTransparency(0)

local GUI = script.LoadingScreen:Clone()
GUI.Parent = PlayerGui

local StartButton = script.LoadingScreen.Frame.TextButton
local Loading = script.LoadingScreen.Frame.TextLabel

repeat wait(1) until game:IsLoaded()

Loading.Visible = false
StartButton.Visible = true

if StartButton.MouseButton1Click then
	GUI.Frame:TweenPosition(UDim2.new(0,0,1,0),"InOut","Sine",0.5)
	wait(0.5)
	GUI:Destroy()
end

Also, here is my explorer tree where this part of the code is:

ReplicatedFirst >LocalScript >LoadingScreen >Frame >TextButton >TextLabel

4 comments

0

the text button and label are beside each other, not the text label inside the button

0

bruh why is it in replicated first, all you had to do is put the gui into starter gui, make the script in there, and move on with life. i could have done this same thing in five lines but you chose 21.

0

to be honest, im not the best scripter. im more, beginner level, and this was based off of a tutorial by alvinblox. Thanks for your feedback!

0

Dan_PanMan, please do not give false advice. He has done it the correct way, as the default loading screen will be removed correctly, on the dev forum it says to put it in ReplicatedFirst. Please, do your research.

1 answer

✓ Accepted answer

I would recommend controlling a button through the script cloning it. From what I can see the GUI is already created, therefore add the following code inside a script inside the textButton and it should work.

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent:TweenPosition(UDim2.new(0,0,1,0))
	wait (1)
	script.Parent.Parent.Parent:Destroy()
end)

1 comment

0

Thanks! I will try this as soon as i can.

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