I need hep with a character picker script

Hey i have e problem with this script


it works but for some reason it works only one person the script is in serverscriptservice
and idk whats the problem it works fine for only one player if you need more info ask me :smiley:

You’re only referring one player.

so i should do just

game.Players

That’s because you’re trying to use StarterGui on a Server Script. Using StarterGui is in the wrong way, The right way (as far as i know) is getting the PlayerGui and then getting the other Guis inside of it.

You would need to check this whenever a Player joins the game. (Although this could be switched by a LocalScript that controls the Gui)

It would look like something like this (If it was on Server):

-- Variables
local Players = game:GetService("Players")

-- Main
Players.PlayerAdded:Connect(function(Player)
    local PlayerGui = Player:WaitForChild("PlayerGui", 60)
    -- Code here
end)

No you don’t.

You do a for loop and high iterates all players in your server.

why the 60 after “PlayerGui” ,

That’s the timeOut variable, As the Gui may not load right after they join the game. It will basically yield during 60 seconds if needed to wait until the Gui loads.


here is the current script it works untill i get after print “wait1”

Out of curiosity, why is there a wait(24) right above your .PlayerAdded event?

plr.PlayerAdded.Team does not refer to the player, you already have the player parameter from the plr.PlayerAdded:Connect(function(Player) line, use “Player” as your player

The plr:WaitForChild(“PlayerGui”,60) will always yield because your Waiting for the PlayerGui in the players service

cuz its a start game script in another script it does player gets chosen to be monster for aroun 20 sec so i made it to happen after its all done

Then why not use a bindable event for that? It would be more accurate when both your scripts should communicate to each other for the start of a game

i still dont know how to do that so for now ima leave it like this

also still doesnt work

You need to remove the wait(24) line.

ik i found the problem but i need the wait(24) so i will try something else

You need to remove that line otherwise the .PlayerAdded event connection won’t be created until 24 seconds after the script executes, at which point the first player instance has already been added and thus the .PlayerAdded event won’t fire for them.

ik dude there is the problem i cant this wait(24) works around the whole game and if i remove it i have to reowork almost the whole game im trowing away the script i will find another way

With that wait() there this code is not executed until 24 seconds after the script’s initial execution, this code will not be executed for any player instance that joins the game before that 24 second window expires.

dude ik i told you ik what u are talking about i fixed the problem

fixed the problemmmmmmmmmmmmmmmmmmmmmmmmm