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

Is it possible for a script without playeradded event to fire before a playeradded event?

Im asking this because I have a round script where I get the player and I set their team in another script

and I have a player added script where I also set the teams in that script

In this case which will fire first?

What I want is PlayerAdded to fire first before the other script fires

because my script will break if some other script fires before PlayerAdded

So is it possible for a script to get the player before PlayerAdded even fires?

2 comments

0

No. It's impossible.

0

The player can't be gotten if the player event hasn't fired. So no, it can't happen.

2 answers


local Players = game:GetService("Players")


Players.ChildAdded:Connect(function() -- this will fire as soon as someone joins the game
    -- add your script here for the team thing
    -- this can go in the script for the teams thing
end)

Players.ChildRemoved:Connect(function() -- this will fire as soon as someone joins the game
    -- add your script here for the team thing
    -- this can go in the script for the teams thing
end)

Players.Changed:Connect(function() -- this will fire when a player joins or leaves
       -- add your script here for the team thing
    -- this can go in the script for the teams thing
end)

1 comment

0

this will work im sure

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