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

Checking if a character has loaded in Round Script?

Asked by 3 years ago

I have a big problem with my Round Script

I need to wait until the character loads to teleport them right away

This is a server side script and I need to somehow find out a way to see if their Humanoid has loaded in

I thought of adding a intermission timer to have the characters wait but I was wondering if a exploiter can maybe like make the character load extremely slow so that my round script becomes messed up and they break my game.

How would I check if a character has loaded in my game

This is a while true do loop Round Script

0
You can't delay your loading. The server loads your character, not the player. radiant_Light203 1166 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Try this, currently untested since my character loaded almost instantly

function checkifallhasloaded()
    local results = {}
    for i,v in pairs(game.Players:GetPlayers()) do
        if v:HasAppearanceLoaded() then
            table.insert(results,i,true)
        else
            table.insert(results,i,false)
        end
    end
    local hey = 0
    for i,v in pairs(results) do
        if v == true then
            hey = hey + 1
        end
    end
    if hey == #game.Players:GetPlayers() then
        return "ok"
    else
        return "notok"
    end
end

repeat
    wait()
    print("waiting")
until checkifallhasloaded() =="ok"
print('ok')
0
Simply checks if all player's appearance has loaded, if so it records whether its true/false into a table of results, which will be checked if all are true ChristianTRPOC 64 — 3y
0
Or you could just WaitForChild("Humanoid") for each player in a for i,v in pairs(game.Players:GetPlayers()) loop ChristianTRPOC 64 — 3y
0
Yea this is much simpler. Just use :WaitForChild() Soban06 410 — 3y
Ad

Answer this question