|
| 23 May 2012 06:42 AM |
hi guys ive got this loadinstance thingy here for my store
its ment to load a model with bool values inside it but its not finding any instance :(
can anyone see whats wrong?
(the rest of the script works fine when loading the players score its just the store part :( local ShopStuff if not pcall(function() ShopStuff = player:LoadInstance("ShopStuff") end) then print("making store data") ShopStuff = Instance.new("Model") ShopStuff.Name = "Shop"
local mid = Instance.new("BoolValue") mid.Value = false mid.Name = "Midway" mid.Parent = ShopStuff print("made store data") end |
|
|
| Report Abuse |
|
|
| |
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 23 May 2012 12:51 PM |
You should put something like player:WaitForDataReady() |
|
|
| Report Abuse |
|
|
|
| 23 May 2012 04:30 PM |
there is i forgot to put it in here though
function beginLoadingData(player) print("starting") player:WaitForDataReady() local KOs if not pcall(function() KOs = player:LoadNumber("KOs") end) then KOs = 0 end local WOs if not pcall(function() WOs = player:LoadNumber("WOs") end) then WOs = 0 end local Points if not pcall(function() Points = player:LoadNumber("Points") end) then Points = 0 end
thats the begining part of that script after that it wont work with the loadinstance :(
|
|
|
| Report Abuse |
|
|
|
| 24 May 2012 09:59 AM |
| can some one send how they would use the save and load instance thing please :( |
|
|
| Report Abuse |
|
|
|
| 24 May 2012 10:19 AM |
function beginLoadingData(player) print("starting") player:WaitForDataReady() local KOs if not pcall(function() KOs = player:LoadNumber("KOs") end) then KOs = 0 end local WOs if not pcall(function() WOs = player:LoadNumber("WOs") end) then WOs = 0 end local Points if not pcall(function() Points = player:LoadNumber("Points") end) then Points = 0 end local shop if not pcall(function() shop = player:LoadNumber("ShopData") end) then shop = nil end
while (not player:findFirstChild("leaderstats")) do wait() end if (player:findFirstChild("leaderstats")) then print("found leader stats") player.leaderstats.KOs.Value = KOs player.leaderstats.WOs.Value = WOs player.leaderstats.Points.Value = Points --ShopStuff.Parent = player.leaderstats end if (shop) then for i,v in pairs(player.leaderstats.Points:getChildren()) do local nameofaspect = shop:findFirstChild(v.Name) if (nameofaspect) then v.Value = nameofaspect.Value end end print("Shop data loaded") end
can anyone see any problems with this? if not then its gona be uploaded like this :) |
|
|
| Report Abuse |
|
|
| |
|
| |
|