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

Load and save system glitch, can anyone help?

Asked by 10 years ago

I made a save/load thing for my monopoly game. Here is the script, it doesn't seem to save anything.

game.Players.PlayerAdded:connect(function(newplr)
    local holder = Instance.new("Model")
    holder.Name = "DemPizzaStats"
    holder.Parent = newplr
local numPizzaBoxes = Instance.new("NumberValue")
local numPizzaPlaces = Instance.new("NumberValue")
local numPizzaReg = Instance.new("NumberValue")
local MoneyPS = Instance.new("NumberValue")
local Money = Instance.new("NumberValue")
local Multiplier = Instance.new("NumberValue")
Multiplier.Name = "MultiplierValue"
Multiplier.Value = 2
Multiplier.Parent = holder
numPizzaBoxes.Name = "Numberofpchefs"
numPizzaReg.Name = "Numberofrchefs"
numPizzaReg.Value = 0
numPizzaReg.Parent = holder
local numPizzaAds = Instance.new("NumberValue")
numPizzaAds.Parent = holder
numPizzaAds.Value = 0
numPizzaAds.Name = "Numberofads"
local numofcritics = Instance.new("NumberValue")
numofcritics.Value = 0
numofcritics.Name = "Numberofcritics"
numofcritics.Parent = holder
numPizzaPlaces.Name = "Numberofpp"
MoneyPS.Name = "Customersps"
MoneyPS.Value = 0
Money.Name = "Money"
Money.Value = 0
numPizzaBoxes.Value = 0
numPizzaPlaces.Value = 0
MoneyPS.Parent = holder
Money.Parent = holder
numPizzaBoxes.Parent = holder
numPizzaPlaces.Parent = holder
    newplr:WaitForDataReady()
newplr:LoadNumber("Money")  
newplr:LoadNumber("Numberofads")    
newplr:LoadNumber("Numberofpp")
newplr:LoadNumber("Numberofcritics")
newplr:LoadNumber("MultiplierValue")
newplr:LoadNumber("Customersps")    
newplr:LoadNumber("Numberofpchefs") 
newplr:LoadNumber("Numberofrchefs") 
end)
game.Players.PlayerRemoving:connect(function(byebye)
    byebye:WaitForDataReady()
byebye:SaveNumber("Money", byebye.DemPizzaStats.Money.Value)    
byebye:SaveNumber("Numberofads", byebye.DemPizzaStats.Numberofads.Value)    
byebye:SaveNumber("Numberofpp", byebye.DemPizzaStats.Numberofpp.Value)
byebye:SaveNumber("Numberofcritics", byebye.DemPizzaStats.Numberofcritics.Value)
byebye:SaveNumber("MultiplierValue", byebye.DemPizzaStats.MultiplierValue.Value)
byebye:SaveNumber("Customersps", byebye.DemPizzaStats.Customersps.Value)    
byebye:SaveNumber("Numberofpchefs", byebye.DemPizzaStats.Numberofpchefs.Value)  
byebye:SaveNumber("Numberofrchefs", byebye.DemPizzaStats.Numberofrchefs.Value)          
end)
script.Parent.Hours.Changed:connect(function()
for i, v in pairs(game.Players:GetChildren()) do
if v:IsA("Player") then
moneyrandom = math.random(2, 50)
v.DemPizzaStats.Money.Value = v.DemPizzaStats.Money.Value + moneyrandom *v.DemPizzaStats.Customersps.Value
end 
end
end)

Answer this question