How do games insert scripts or objects at players?

So, a lot of games that i have seen have something that inserts things like Values / Scripts / Etc into the player, how do i achieve that?

local val = Instance.new("IntValue")
val.Parent = player
1 Like

Check when the player joins using the PlayerAdded event then using Instance.new() to add the values to the player.

1 Like

You can achieve this by whriting the following lines of code inside a script:

Local leaderstats = Instance.new("Folder")
leaderstate.Parent = game:GetService("Players").LocalPlayer
leaderstats.Name = "leaderstats"

Local Coins = Instance.new("NumberValue")
Coins.Parent = leaderstats
Coins.Name = "Coins"
Coins.Value = 0 --Here you can set the amount of coins you start with