I need hep with a character picker script

No, you don’t seem to understand the issue, that code isn’t executed for any player which joins within the first 24 seconds of the server starting essentially rendering it useless. If your game relies on that wait then move it inside the PlayerAdded event itself.

local players = game:GetService("Players")

local isLoading = true

players.PlayerAdded:Connect(function(player)
	if isLoading then
		task.wait(24)
		isLoading = false
	end
end)

i dont understand this code and how to do it with mine i already have a way of doing the thing i wanted to do but it only works after the 26 seconds and thats the only way i understand of making it work when i want it to work and not the second everything happens


thats the script it works but i want to make it work when this script ends

to make it when this ends the first one starts and not after 26 secs thats what i asked and i dont understand the listed in ur reply above if it is the awnser to the question can you please explane thanks for ur time

You could use a RemoteEvent that you fire from the client script that is used for picking a character passing the character. Also your plr variable never is given a value.

--LocalScript
buttonName.MouseButton1Click:Connect(function() --Replace "buttonName" with the character button
    ReplicatedStorage.ChoseCharacter:FireServer(character.Name) --Replace "character" with the character that the player chose
end)

--ServerScript (this is your script in ServerScriptService)
--Note: I didn't add everything from your script
local plr

game.Players.PlayerAdded:Connect(function(player)
    plr = player

    plrcount += 1

    print(plrcount)
end)

ReplicatedStorage.ChoseCharacter.OnServerEvent:Connect(function(player, characterName)
     local chosen = plrs:GetPlayers()[math.random1, #plrs:GetPlayers())]
     plr.PlayerGui.Chosengui.MFrame.Team.Text = characterName
     plr.PlayerGui.Chosengui.MFrame.Visible = true
     plr.Team = game.Teams:GetChildren()[characterName]

     for _, plr in pairs(plrs:GetPlayers()) do
         if plr ~= chosen then
             table.insert(survivors, plr)

             plr.PlayerGui.Chosengui.MFrame.Team.Text = "Survivor"
             plr.PlayerGui.Chosengui.MFrame.Visible = true
             plr.Team = game.Team.Survivors
         end
     end
end)

Be aware I didn’t get test this code so let me know if there’s any problems! :slight_smile:

hey question here why is there a button.mousebutton1 bla bla when these scripts are not made for a button im aware i can use remote event i do use remote events just not for this script here

The MouseButton function is just an option. It’s just a way of detecting that the player chose a character, then sending the RemoteEvent to the server so the server knows to spawn the player as that chosen character.

I’m just using the MouseButton function as a way of knowing that the player pressed a button that relates to a certain character so I can fire the RemoteEvent and pass the chosen character’s name.