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

why does my loading screen not fade out when the player's character enters the game?

here is my script, its in a localscript:

while true do
local rand = math.random(1,5)
local text = {'omg you will not believe this','"Too glowy" - Albert Einstein','We already know that all minions are hot','load.exe has stopped loading','Neon.exe has stopped responding'}
script.Parent.Text = text[rand]
game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
local torso = char:WaitForChild('UpperTorso')
for i = 0,1,.2 do
	script.Parent.BackgroundTransparency = i
	wait(.1)
end
	end)
end)
wait(5)
end

2 comments

0

Do you want the screen to output each sentence in the order that you have them in the script?

0

Is that local script inside a client (player) or is it somewhere else in the game? If it's in the client, you don't use game.Players.PlayerAdded because you're only dealing with one specific client. If however, it's somewhere else, use a normal script, not a local one.

1 answer

This is all the code you needed to do. Keep the following code in a local script in the same place you had it before. The problem was, you were using the for loop inside the unnecessary CharacterAdded function, inside the PlayerAdded function.

Basically, this means that your screen would only show up after someone else had joined you into the game and their character had loaded.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()

local Text = {
	'Omg you will not believe this';
	"'Too glowy' - Albert Einstein";
	'We already know that all minions are hot';
	'load.exe has stopped loading';
	'Neon.exe has stopped responding';
}

script.Parent.Text = (Text[math.random(1, #Text)])

for i = 0, 1, .02 do
	script.Parent.BackgroundTransparency = i
	script.Parent.TextTransparency = i
	wait(.1)
end

-- script.Parent:Destroy()

For future reference, people are more likely to help you with your code if you leave it properly indented as Roblox Studio should automatically do it for you.

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