|
| 24 Feb 2016 06:45 PM |
-- Trails local Roblox = game:GetService("DataStoreService"):GetDataStore("Roblox") local Doge = game:GetService("DataStoreService"):GetDataStore("Doge") local AnnoyingDog = game:GetService("DataStoreService"):GetDataStore("Annoying Dog") local Temmie = game:GetService("DataStoreService"):GetDataStore("Temmie") local SpookyScarySkeleton = game:GetService("DataStoreService"):GetDataStore("SpookyScarySkeleton") local Sanic = game:GetService("DataStoreService"):GetDataStore("Sanic")
--Money local Money = game:GetService("DataStoreService"):GetDataStore("Money")
function saveMoney(player) Money:SetAsync(player.UserId, player.PlayerImage.Money.ScrollingFrame.Money.Value) end
function loadMoney(player) local MoneyAmount = Money:GetAsync(player.UserId) if MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value = MoneyAmount elseif not MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value = 0 end end
function saveTrails(player) Roblox:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Doge:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) AnnoyingDog:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Temmie:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) SpookyScarySkeleton:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Sanic:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) end
function loadTrails(player) local Trail1 = Roblox:GetAsync(player.UserId) local Trail2 = Doge:GetAsync(player.UserId) local Trail3 = AnnoyingDog:GetAsync(player.UserId) local Trail4 = Temmie:GetAsync(player.UserId) local Trail5 = SpookyScarySkeleton:GetAsync(player.UserId) local Trail6 = Sanic:GetAsync(player.UserId) if Trail1 == true then player.PlayerGui.Trails.ImageLabel.Roblox.Value = Trail1 end if Trail2 == true then player.PlayerGui.Trails.ImageLabel.Doge.Value = Trail2 end if Trail3 == true then player.PlayerGui.Trails.ImageLabel["AnnoyingDog"].Value = Trail3 end if Trail4 == true then player.PlayerGui.Trails.ImageLabel.Temmie.Value = true end if Trail5 == true then player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value = Trail4 end if Trail6 == true then player.PlayerGui.Trails.ImageLabel.Sanic.Value = Trail5 end end
function onPlayerEntered(newPlayer) loadTrails(newPlayer) loadMoney(newPlayer) end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoved(newPlayer) saveTrails(newPlayer) saveMoney(newPlayer) end
game.Players.PlayerRemoving:connect(onPlayerRemoved) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 24 Feb 2016 07:01 PM |
-- Trails local Roblox = game:GetService("DataStoreService"):GetDataStore("Roblox") local Doge = game:GetService("DataStoreService"):GetDataStore("Doge") local AnnoyingDog = game:GetService("DataStoreService"):GetDataStore("Annoying Dog") local Temmie = game:GetService("DataStoreService"):GetDataStore("Temmie") local SpookyScarySkeleton = game:GetService("DataStoreService"):GetDataStore("SpookyScarySkeleton") local Sanic = game:GetService("DataStoreService"):GetDataStore("Sanic")
--Money local Money = game:GetService("DataStoreService"):GetDataStore("Money")
function saveMoney(player) Money:SetAsync(player.UserId, player.PlayerImage.Money.ScrollingFrame.Money.Value) end
function loadMoney(player) local MoneyAmount = Money:GetAsync(player.UserId) if MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value = MoneyAmount elseif not MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value = 0 end end
function saveTrails(player) Roblox:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Doge:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) AnnoyingDog:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Temmie:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) SpookyScarySkeleton:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Sanic:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) end
function loadTrails(player) local Trail1 = Roblox:GetAsync(player.UserId) local Trail2 = Doge:GetAsync(player.UserId) local Trail3 = AnnoyingDog:GetAsync(player.UserId) local Trail4 = Temmie:GetAsync(player.UserId) local Trail5 = SpookyScarySkeleton:GetAsync(player.UserId) local Trail6 = Sanic:GetAsync(player.UserId) if Trail1 == true then player.PlayerGui.Trails.ImageLabel.Roblox.Value = Trail1 end if Trail2 == true then player.PlayerGui.Trails.ImageLabel.Doge.Value = Trail2 end if Trail3 == true then player.PlayerGui.Trails.ImageLabel["AnnoyingDog"].Value = Trail3 end if Trail4 == true then player.PlayerGui.Trails.ImageLabel.Temmie.Value = Trail4 end if Trail5 == true then player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value = Trail5 end if Trail6 == true then player.PlayerGui.Trails.ImageLabel.Sanic.Value = Trail6 end end
function onPlayerEntered(newPlayer) loadTrails(newPlayer) loadMoney(newPlayer) end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoved(newPlayer) saveTrails(newPlayer) saveMoney(newPlayer) end
game.Players.PlayerRemoving:connect(onPlayerRemoved)
i join the place and wait for it to change my money then when it does change my money i leave and rejoin and my money is back to 0 |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 07:37 PM |
-- Trails local Roblox = game:GetService("DataStoreService"):GetDataStore("Roblox") local Doge = game:GetService("DataStoreService"):GetDataStore("Doge") local AnnoyingDog = game:GetService("DataStoreService"):GetDataStore("Annoying Dog") local Temmie = game:GetService("DataStoreService"):GetDataStore("Temmie") local SpookyScarySkeleton = game:GetService("DataStoreService"):GetDataStore("SpookyScarySkeleton") local Sanic = game:GetService("DataStoreService"):GetDataStore("Sanic")
--Money local Money = game:GetService("DataStoreService"):GetDataStore("Money")
function saveMoney(player) Money:SetAsync(player.UserId, player.PlayerImage.Money.ScrollingFrame.Money.Value.Value) end
function loadMoney(player) local MoneyAmount = Money:GetAsync(player.UserId) if MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = MoneyAmount elseif not MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = 0 end end
function saveTrails(player) Roblox:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Doge:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) AnnoyingDog:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Temmie:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) SpookyScarySkeleton:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Sanic:SetAsync(player.UserId, player.PlayerGui.Trails.ImageLabel.Roblox.Value) end
function loadTrails(player) local Trail1 = Roblox:GetAsync(player.UserId) local Trail2 = Doge:GetAsync(player.UserId) local Trail3 = AnnoyingDog:GetAsync(player.UserId) local Trail4 = Temmie:GetAsync(player.UserId) local Trail5 = SpookyScarySkeleton:GetAsync(player.UserId) local Trail6 = Sanic:GetAsync(player.UserId) if Trail1 == true then player.PlayerGui.Trails.ImageLabel.Roblox.Value = Trail1 end if Trail2 == true then player.PlayerGui.Trails.ImageLabel.Doge.Value = Trail2 end if Trail3 == true then player.PlayerGui.Trails.ImageLabel["AnnoyingDog"].Value = Trail3 end if Trail4 == true then player.PlayerGui.Trails.ImageLabel.Temmie.Value = Trail4 end if Trail5 == true then player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value = Trail5 end if Trail6 == true then player.PlayerGui.Trails.ImageLabel.Sanic.Value = Trail6 end end
function onPlayerEntered(newPlayer) loadTrails(newPlayer) loadMoney(newPlayer) end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoved(newPlayer) saveTrails(newPlayer) saveMoney(newPlayer) end
game.Players.PlayerRemoving:connect(onPlayerRemoved)
can someone please help? It wont save or load the data |
|
|
| Report Abuse |
|
|
| |
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Feb 2016 08:05 PM |
Idk but put this at the bottom (keep it if it doesn't fix the problem anyway, when using datastores you should use this)
game.OnClose = function() wait(10) end |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Feb 2016 08:06 PM |
Also I noticed a bug in which could be the issue. When you set the async, for the keys you did 'player.UserId'
UserId isn't capitalized. Here's the proper spelling: userId
Lua is case-sensitive. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:07 PM |
| ok thx and ill see if it fixes the problem |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:08 PM |
| ok I fixed the userid issue to and I'm gonna test if it fixed the datastore |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:09 PM |
| It didn't fix the problem, but thx for the idea. do u have any other ideas that might fix the problem? |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Feb 2016 08:11 PM |
Well those were the main ones. You are using get and set async ALOT for many datastores. You should try to merge them into one datastore and use set and get async as minimal as possible.
You can use tables.
here's an example of how you'd save a table to datastores:
datastore:SetAsync(key, {2,3,4,player.Something.Value})
local get = datastore:GetAsync(key)
if get then
print(get[1]) > 2 |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:15 PM |
like local key = {Roblox, Doge, AnnoyingDog, Temmie, SpookyScarySkeleton, Sanic} ? |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:16 PM |
| if not the what would key be defined as? |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Feb 2016 08:19 PM |
| There is so many different DataStores because each one is a different trail |
|
|
| Report Abuse |
|
|
TaaRt
|
  |
| Joined: 26 Apr 2009 |
| Total Posts: 5039 |
|
|
| 24 Feb 2016 08:19 PM |
| unsuccessful troll is unsuccessful |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:25 PM |
| I cant figure out whats wrong. I'm not even sure if it matters how many times you use Async. Plz help I really need to fix this |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:27 PM |
-- Trails local Roblox = game:GetService("DataStoreService"):GetDataStore("Roblox") local Doge = game:GetService("DataStoreService"):GetDataStore("Doge") local AnnoyingDog = game:GetService("DataStoreService"):GetDataStore("Annoying Dog") local Temmie = game:GetService("DataStoreService"):GetDataStore("Temmie") local SpookyScarySkeleton = game:GetService("DataStoreService"):GetDataStore("SpookyScarySkeleton") local Sanic = game:GetService("DataStoreService"):GetDataStore("Sanic")
datastore:SetAsync(key, {2,3,4,player.Something.Value}) --Money local Money = game:GetService("DataStoreService"):GetDataStore("Money")
function saveMoney(player) Money:SetAsync(player.userid, player.PlayerImage.Money.ScrollingFrame.Money.Value.Value) end
function loadMoney(player) local MoneyAmount = Money:GetAsync(player.userid) if not MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = 0 else player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = MoneyAmount end end
function saveTrails(player) Roblox:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Doge:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Doge.Value) AnnoyingDog:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel["Annoying Dog"].Value) Temmie:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Temmie.Value) SpookyScarySkeleton:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value) Sanic:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Sanic.Value) end
function loadTrails(player) local Trail1 = Roblox:GetAsync(player.userid) local Trail2 = Doge:GetAsync(player.userid) local Trail3 = AnnoyingDog:GetAsync(player.userid) local Trail4 = Temmie:GetAsync(player.userid) local Trail5 = SpookyScarySkeleton:GetAsync(player.userid) local Trail6 = Sanic:GetAsync(player.userid) if Trail1 == true then player.PlayerGui.Trails.ImageLabel.Roblox.Value = Trail1 end if Trail2 == true then player.PlayerGui.Trails.ImageLabel.Doge.Value = Trail2 end if Trail3 == true then player.PlayerGui.Trails.ImageLabel["AnnoyingDog"].Value = Trail3 end if Trail4 == true then player.PlayerGui.Trails.ImageLabel.Temmie.Value = Trail4 end if Trail5 == true then player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value = Trail5 end if Trail6 == true then player.PlayerGui.Trails.ImageLabel.Sanic.Value = Trail6 end end
function onPlayerEntered(newPlayer) newPlayer:WaitForDataReady() loadTrails(newPlayer) loadMoney(newPlayer) end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoved(newPlayer) saveTrails(newPlayer) saveMoney(newPlayer) end
game.Players.PlayerRemoving:connect(onPlayerRemoved)
game.OnClose = function() wait(10) end
just found another problem that I fixed above. I made the saveTrails function save all save the value of one trail |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:28 PM |
-- Trails local Roblox = game:GetService("DataStoreService"):GetDataStore("Roblox") local Doge = game:GetService("DataStoreService"):GetDataStore("Doge") local AnnoyingDog = game:GetService("DataStoreService"):GetDataStore("Annoying Dog") local Temmie = game:GetService("DataStoreService"):GetDataStore("Temmie") local SpookyScarySkeleton = game:GetService("DataStoreService"):GetDataStore("SpookyScarySkeleton") local Sanic = game:GetService("DataStoreService"):GetDataStore("Sanic")
--Money local Money = game:GetService("DataStoreService"):GetDataStore("Money")
function saveMoney(player) Money:SetAsync(player.userid, player.PlayerImage.Money.ScrollingFrame.Money.Value.Value) end
function loadMoney(player) local MoneyAmount = Money:GetAsync(player.userid) if not MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = 0 else player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = MoneyAmount end end
function saveTrails(player) Roblox:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Roblox.Value) Doge:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Doge.Value) AnnoyingDog:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel["Annoying Dog"].Value) Temmie:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Temmie.Value) SpookyScarySkeleton:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value) Sanic:SetAsync(player.userid, player.PlayerGui.Trails.ImageLabel.Sanic.Value) end
function loadTrails(player) local Trail1 = Roblox:GetAsync(player.userid) local Trail2 = Doge:GetAsync(player.userid) local Trail3 = AnnoyingDog:GetAsync(player.userid) local Trail4 = Temmie:GetAsync(player.userid) local Trail5 = SpookyScarySkeleton:GetAsync(player.userid) local Trail6 = Sanic:GetAsync(player.userid) if Trail1 == true then player.PlayerGui.Trails.ImageLabel.Roblox.Value = Trail1 end if Trail2 == true then player.PlayerGui.Trails.ImageLabel.Doge.Value = Trail2 end if Trail3 == true then player.PlayerGui.Trails.ImageLabel["AnnoyingDog"].Value = Trail3 end if Trail4 == true then player.PlayerGui.Trails.ImageLabel.Temmie.Value = Trail4 end if Trail5 == true then player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value = Trail5 end if Trail6 == true then player.PlayerGui.Trails.ImageLabel.Sanic.Value = Trail6 end end
function onPlayerEntered(newPlayer) newPlayer:WaitForDataReady() loadTrails(newPlayer) loadMoney(newPlayer) end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoved(newPlayer) saveTrails(newPlayer) saveMoney(newPlayer) end
game.Players.PlayerRemoving:connect(onPlayerRemoved)
game.OnClose = function() wait(10) end
this is what I have now |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 24 Feb 2016 08:38 PM |
| 62GB what would I put in the script to put the datastores together in a table and then into one datastore? |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 24 Feb 2016 08:48 PM |
| Mmm. I gave you an example on how it would be done if you were gonna try to use only 1 datastore to save everything. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2016 08:58 PM |
-- Trails local Roblox = game:GetService("DataStoreService"):GetDataStore("Roblox")[1] local Doge = game:GetService("DataStoreService"):GetDataStore("Doge")[2] local AnnoyingDog = game:GetService("DataStoreService"):GetDataStore("Annoying Dog")[3] local Temmie = game:GetService("DataStoreService"):GetDataStore("Temmie")[4] local SpookyScarySkeleton = game:GetService("DataStoreService"):GetDataStore("SpookyScarySkeleton")[5] local Sanic = game:GetService("DataStoreService"):GetDataStore("Sanic")[6]
local DataStore = game:GetService("DataStoreService") local key = player.userid
--Money local Money = game:GetService("DataStoreService"):GetDataStore("Money")
function saveMoney(player) Money:SetAsync(player.userid, player.PlayerImage.Money.ScrollingFrame.Money.Value.Value) end
function loadMoney(player) local MoneyAmount = Money:GetAsync(player.userid) if not MoneyAmount then player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = 0 else player.PlayerGui.Money.ScrollingFrame.Money.Value.Value = MoneyAmount end end
function saveTrails(player) DataStore:SetAsync(key,{1,2,3,4,5,6, player.PlayerGui.Trails.ImageLabel.Roblox.Value,player.PlayerGui.Trails.ImageLabel.Doge.Value, player.PlayerGui.Trails.ImageLabel["Annoying Dog"].Value,player.PlayerGui.Trails.ImageLabel.Temmie.Value,player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value,player.PlayerGui.Trails.ImageLabel.Sanic.Value}) end
function loadTrails(player) local get = DataStore:GetAsync(key) if get[1] == true then player.PlayerGui.Trails.ImageLabel.Roblox.Value = get[1] end if get[2] == true then player.PlayerGui.Trails.ImageLabel.Doge.Value = get[2] end if get[3] == true then player.PlayerGui.Trails.ImageLabel["AnnoyingDog"].Value = get[3] end if get[4] == true then player.PlayerGui.Trails.ImageLabel.Temmie.Value = get[4] end if get[5] == true then player.PlayerGui.Trails.ImageLabel["Spooky Scary Skeleton"].Value = get[5] end if get[6] == true then player.PlayerGui.Trails.ImageLabel.Sanic.Value = get[6] end end
function onPlayerEntered(newPlayer) newPlayer:WaitForDataReady() loadTrails(newPlayer) loadMoney(newPlayer) end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoved(newPlayer) saveTrails(newPlayer) saveMoney(newPlayer) end
game.Players.PlayerRemoving:connect(onPlayerRemoved)
game.OnClose = function() wait(10) end
like this? |
|
|
| Report Abuse |
|
|