I tried making a player specific StarterCharacter Script, But im new at scripting and cant find how to do this

local players = {“YodaKL”}
local startercharacter = game.ServerStorage.jeffiestartercharacter
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
for i = 1, #players do
if players[i] == plr.Name then
startercharacter:Clone() .parent = plr:WaitforChild(“StarterPlayer”)
end
end
end)
end)

– I tried making this but it did nothing.

Your problem is that in the studio the Player.Added does not fire properly. To counter this problem you can use a loop to get all the players in the game before the Player.Added function. Here’s an example:

local PlayerList = {
    00000, -- UserIds
    "YodaKL", -- Usernames
}

function run(Player)
    if table.find(PlayerList, Player.Name) or table.find(PlayerList, Player.UserId) then
        print(Player.Name ..": Yes")
        -- Your code here
    else
        print(Player.Name ..": No")
    end
end

Players = game:GetService("Players")
for i, player in pairs(Players:GetPlayers()) do
    run(player)
end

game.Players.PlayerAdded:Connect(run)

Also, I wound recommend you using Player.UserId instead of the username, in case that any of the players in the list changes their username, the UserId never changes.

1 Like

I’m actually kind of new at scripting aswell- but one of the problems may be that you wrote “YodaKL”. I’m not sure if this is just me, but your username doesn’t start with a capital letter, so maybe remove the capital letter and replace it with lowercase? so “yodaKL” instead of “YodaKL”. That might help : )

Is there like a tutorial for this specific type of thing? Because i dont know how half of these things work.

Not about this case specific.
As dizzyspots said if x == y then will check exactly if x and y are the same, meaning that yodaKL and YodaKL are different words because of the capital “Y”, here you can:

  • Type the names exactly
  • Use userids
  • Use the string.lower function

If you want to learn more about scripting, there’s Roblox provides you with documentation:

Player (Username, UserId…): Player | Roblox Creator Documentation
String.Lower: string | Roblox Creator Documentation
Loops: Introduction to Scripting | Roblox Creator Documentation

1 Like

Thanks! i think this is going to be be really usefull for learning.