Hey Scripters, I already made a leaderstats and called it “Tickets” but I want it so when my friend (id) joins he gets 1B Tickets. I have no idea how to work with that. Of course me being the absolute noob I am. I tried taking it to YouTube (pointless) or asking my friends but no one is online. PLEASE HELP ME : (
local id = 111111111111111
if id then
player.leaderstats.Tickets.Value = player.leaderstats.Tickets.Value + 1000000000
I would not count on usernames. UserId is highly more accurate and flexible than the name. For instance, my ID is always 27881264, but my username can be changed.
What type of script do I make it. Where do I place it?
Edit: It is a regular script in Workspace
Edit 2: @AviaBasil It still doesn’t work for some reason?
Put a script inside of ServerScriptService.
U can call it whatever u want or like.
Make sure it’s a normal script and not a local script!
Then put this inside the script:
local id = put your friend’s user id here
game.Players.PlayerAdded:Connect(function(player)
if player.UserId == id then
print(“This player is your friend”)
player.leaderstats.Coins.Value = 1000000000
–set the coins to the stats u have!
end
end)
game.Players.PlayerAdded:Connect(function(player)
if player.UserId == "id" then
player.leaderstats.Tickets.Value = player.leaderstats.Tickets.Value + 1000000000
end
end)
game.Players.PlayerAdded:Connect(function(plr)
if plr.UserId == 111111111111111 then
plr:WaitForChild("leaderstats"):WaitForChild("Tickets").Value += 1000000000
end
end)
Put this code inside a script in server script service. Good luck!
If your using the examples provided by @lifacy and @alliedoeihoialt, you can place them as regular scripts in server script service as @alliedoeihoialt Fixed his to use the added player!