Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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
0
Do you want the screen to output each sentence in the order that you have them in the script? sodaghost1 34 — 6y
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. sodaghost1 34 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question