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

ReplicatedFirst - How do I make the Load screen finish, before a player is added to the game?

Asked by 6 years ago

Hello!

Question: How do I set up my ReplicatedFirst script with it's custom Load screen to finish, before the player is added to the game?

My game is a deathmatch rounds system, and players can pop into a game that's currently on-going, but with the load screen, they're sitting ducks waiting for the load screen to fade away, while other players are able to attack them. I want the load screen to finish loading, before they're added to the game.

Example script:

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

local screen = Instance.new("ScreenGui")
screen.Parent = PlayerGui

local textLabel = Instance.new("TextLabel")
textLabel.Text = "Loading"
textLabel.Size = UDim2.new(1,0,1,0)
textLabel.FontSize = Enum.FontSize.Size14
textLabel.Parent = screen

script.Parent:RemoveDefaultLoadingScreen()

local count = 0
local start = tick()
while tick() - start < 6 do
    textLabel.Text = "Loading " .. string.rep(".",count)
    count = (count + 1) % 4
    wait(.3) 
end
 PlayerGui:SetTopbarTransparency(1)
screen.Parent = nil

Thanks!

1 answer

Log in to vote
1
Answered by
wind_o 15
6 years ago

There are different ways to go about this.

I'd recommend to make a player invincible until they're done loading in. This can simply be done by giving them a force-field. When their loading is done, they fire a RemoteEvent so the server can remove their forcefield.

You can also turn off CharacterAutoLoads and load the player in manually when their loading is done. Again, the server should be notified of this using a RemoteEvent.

Hope I helped!

Ad

Answer this question