Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Leaderboard fail, need help?

Asked by 10 years ago

I am making a tycoon with a leaderboard for cash.

01-- leaderboard made by roboy5857
02 
03function onPlayerEntered(newPlayer)
04    local stats = Instance.new("IntValue")
05    stats.Name = "leaderstats"
06 
07    local Moneyz = Instance.new("IntValue")
08    Moneyz.Name = "Moneyzz"
09    Moneyz.Value = 5
10 
11    Moneyz.Parent = stats
12end

It won't work, why?

1 answer

Log in to vote
1
Answered by
Mauvn 100
10 years ago

Try this instead.

01function onPlayerEntered(newPlayer)
02 
03    local stats = Instance.new("IntValue")
04    stats.Name = "leaderstats"
05 
06    local cash = Instance.new("IntValue")
07    cash.Name = "Moneyzz"
08    cash.Value = 5
09 
10    cash.Parent = stats
11    stats.Parent = newPlayer
12end
13 
14 
15 
16game.Players.ChildAdded:connect(onPlayerEntered)
17--You forgot to connect the function like this above

Please note: That if you don't connect a function it's pretty much useless and it wouldn't work.

Ad

Answer this question