Detecting if 10 seconds passed and game didn't load at all

What I want to achieve.

  1. So I want to detect if 10 seconds passed and if the game still didn’t load at all in all these 10 seconds then I want to kick the player that is having the loading issues.

What i got.

  1. 
     RblxRulesFrame_Container.TextBoxLabel.Font = Enum.Font.Arial
     RblxRulesFrame_Container.TextBoxLabel.TextStrokeTransparency = 0
    
     RblxRulesFrame_Container.TextBoxLabel.Text = "Loading..."
     
     for i = 10, 1, - 1 do
     	task.wait(1)
     end
     
     Services.ContentProvider:PreloadAsync(Whole_Game)
    
     RblxRulesFrame_Container.TextBoxLabel.Font = Enum.Font.GothamSemibold
     RblxRulesFrame_Container.TextBoxLabel.TextStrokeTransparency = 1
    
     RblxRulesFrame_Container.TextBoxLabel.Text = Strings.RBLX_RULES
    
     RblxRulesFrame_Container.LoadingButton.Visible = false
     RblxRulesFrame_Container.OkButton.Visible = true
    
     Gui_Container.CursorIcon.Visible = true
     warn("Loaded.")
    end
    
    

All I want is a good way to detect that, and then kick the player. :pray:

Typically I would do this to make the script wait for the player to load:

if not game:IsLoaded() then
    game.Loaded:Wait()
end

But for this case:

task.wait(10)
if not game:IsLoaded() then
    player:Kick("Took too long to load!")
end
1 Like

I’m having an issue, I don’t know where i should put the code…

Can you tell me where I should put this Im trying to figure it out.

Preferably a new script that has it on the top, or a script that needs to wait for the game to be loaded, and on the top of that script.

I already found the solution but thanks for trying to help me!

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