Numbers at the start of the usernames giving error

So i was trying to give my friend some money in my game but suddenly it started to give out errors and i am wondering if it is the reason that he has numbers at the start of his username because when i tried it with my self and my other friends it worked because we dont have numbers starting in our username

Use his account ID instead of his username.

local FRIEND_ID = -- Put your friend's account Id here
local player = game.Players.LocalPlayer

if player.UserId == FRIEND_ID then
    player:WaitForChild("leaderstats").Money == 1000000
end

Never ever use the player’s username when working with players, because it is possible that they change their username.

Instead, use their account ID because it’s not changeable

1 Like

You can’t index instances whose names start with numbers with a dot, instead you can do it like this:
game.Players["4Kboyfredo"].Money or game.Players:FindFirstChild("4Kboyfredo").Money

1 Like

oh i dont know how i didnt think of that

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.