generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: won't save or load

Previous Thread :: Next Thread 
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
01 Mar 2014 05:26 PM
I con't figure out why, it looks perfect to me (well, its a bit messy):

game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()

local Collectables = player:LoadInstance("Collectables")

if Collectables == nil or not player:FindFirstChild("Collectables") then
local Stats = {"Test"}
local Exists = player:FindFirstChild("Collectables")
if not Exists then
local CollectableFldr = Instance.new("Configuration",player)
CollectableFldr.Name = "Collectables"
for i=1,#Stats do
local NewStat = Instance.new("IntValue",CollectableFldr)
NewStat.Name = Stats[i]
local Unlcked = Instance.new("BoolValue", NewStat)
Unlcked = false
end
end
else
if player:FindFirstChild("Collectables") then
player.Collectables:Destroy()
Collectables.Parent = player
else
Collectables.Parent = player
end
end
end)
game.Players.PlayerRemoving:connect(function(player)
Player.Collectables:SaveInstance("Collectables")
end)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
01 Mar 2014 05:28 PM
Shouldn't it be
elseif this

else

Not
else
If this

else

I.e make it an "elseif" and remove one of the ends
Might work
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
01 Mar 2014 05:31 PM
Nope.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
01 Mar 2014 05:32 PM
"Nope"
Did u even try what I said?
Make the
else
if
Into
elseif..

If this then
Dostuff
elseif this then
Dootherstuff
Else
Dothisotherthing
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
01 Mar 2014 05:33 PM
Yes I did. .-.
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
01 Mar 2014 05:34 PM
That didn't fix it .-.
Report Abuse
drahsid5 is not online. drahsid5
Joined: 13 May 2011
Total Posts: 3937
01 Mar 2014 05:46 PM
unless this isn't what you meant:
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()

local Collectables = player:LoadInstance("Collectables")

if Collectables == nil or not player:FindFirstChild("Collectables") then
local Stats = {"Test"}
local Exists = player:FindFirstChild("Collectables")
if not Exists then
local CollectableFldr = Instance.new("Configuration",player)
CollectableFldr.Name = "Collectables"
for i=1,#Stats do
local NewStat = Instance.new("IntValue",CollectableFldr)
NewStat.Name = Stats[i]
local Unlcked = Instance.new("BoolValue", NewStat)
Unlcked = false
end
end
elseif player:FindFirstChild("Collectables") then
player.Collectables:Destroy()
Collectables.Parent = player
else
Collectables.Parent = player
end
end)
game.Players.PlayerRemoving:connect(function(player)
Player.Collectables:SaveInstance("Collectables")
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image