Hello, I'm trying to make a tycoon place, personally for mine only for script practice and testing. What I am currently wandering is what type of object should I put my script in. Should I put it in the normal one 'Script' or in the 'LocalScript'? I don't know what's the difference between them to be honest. Here is my script though! If someone could make it simpler, it would be cool. I haven't tested it online though, only 'Play Solo'.
function onPlayerJoin(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "Leaderstats"
stats.Parent = newPlayer
local cash = Instance.new("IntValue")
cash.Parent = stats
cash.Name = "Cash"
cash.Value = 100
local stats2 = Instance.new("IntValue")
stats2.Name = "Tycoon"
stats2.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerJoin)

3 comments
What's the problem between ChildAdded and PlayerAdded event?
PlayerAdded events do not work well in local scripts, so in them you should use ChildAdded. However, if you're using a server script you should use PlayerAdded because it is built specifically for PLAYERS joining the game, while ChildAdded just fires every time an instance is added to the object it is used on.
Alright, thanks. Very helpful