function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local c = Instance.new("IntValue")
c.Name = "Food"
c.Value = 0
c.Parent = stats
local d = Instance.new("IntValue")
d.Name = "Metal"
d.Value = 0
d.Parent = stats
local e = Instance.new("IntValue")
e.Name = "Wood"
e.Value = 0
e.Parent = stats
local f = Instance.new("IntValue")
f.Name = "Stone"
f.Value = 0
f.Parent = stats
stats.Parent = newPlayer
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
The game works fine until I put this leaderboad script in with 4 different Values (I know the concept is overused, but I don't care)
It seems to shut down my game when I use this script in an attempt to make stats the old fashion way, is this still valid or did Roblox mess up another nice thing about it? |