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

My LeaderStats are Broken? Help!

Asked by 10 years ago

I took some parts and put them together to try to make a LeaderStats Script, so you can track your deaths and kills. Also, the kills in the future will be used to buy Paintball Guns. The script appears but on death, it didn't give the user(s) testing KO's and WO's. Please help and revise any errors, it means alot. Thank you so much!

001function onPlayerEntered(newPlayer)
002 
003 
004    local stats = Instance.new("IntValue")
005    stats.Name = "leaderstats"
006 
007    local kills = Instance.new("IntValue")
008    kills.Name = "Kills"
009    kills.Value = 1
010 
011    local deaths = Instance.new("IntValue")
012    deaths.Name = "Deaths"
013    deaths.Value = 1
014 
015    kills.Parent = stats
View all 122 lines...

1 answer

Log in to vote
0
Answered by 10 years ago

The error occurs on Line 4, as you made the leaderstats an IntValue rather than a Model, it should be something like:

001function onPlayerEntered(newPlayer)
002 
003 
004    local stats = Instance.new("Model")
005    stats.Name = "leaderstats"
006 
007    local kills = Instance.new("IntValue")
008    kills.Name = "Kills"
009    kills.Value = 1
010 
011    local deaths = Instance.new("IntValue")
012    deaths.Name = "Deaths"
013    deaths.Value = 1
014 
015    kills.Parent = stats
View all 122 lines...
Ad

Answer this question