|
| 16 Nov 2014 06:01 PM |
I'm really having trouble with this. I've tried for a couple weeks now but still no luck.
I know it's a bit much but I really need help on this. EFLibrary is a Model in Lighting that contains another Model called Players. Once a Player joins another Model is created within the Players model with their name and containing their values which should load. And they do load correctly. The problem is once I for example change the Attack Value to lets say 100 and I exit the game. I will rejoin and wait for the data to load but it loads to the original starting value.
EFLibrary = game.Lighting:WaitForChild("EFLibrary") EFLibrary:WaitForChild("Players")
DataStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
game.Players.PlayerAdded:connect(function(Player)
local Name = Player.Name wait(12) local Data = EFLibrary.Players:WaitForChild(Player.Name):WaitForChild("PlayerData"):GetChildren()
for Amount = 1, #Data do if DataStore:GetAsync(Data[Amount].Name) then Data[Amount].Value = DataStore:GetAsync(Data[Amount].Name) print(Name .. "'s data has been loaded! Data of " .. Data[Amount].Name) else print(Name .. " has no data to be loaded. Data of " .. Data[Amount].Name) end end end)
game.Players.PlayerRemoving:connect(function(Player) local Name = Player.Name wait(12) local Data = EFLibrary.Players:WaitForChild(Player.Name):WaitForChild("PlayerData"):GetChildren() for Amount = 1, #Data do if DataStore:GetAsync(Data[Amount].Name) then DataStore:SetAsync(Data[Amount].Name, Data[Amount].Value) print(Name .. "'s data has been saved! Data of " .. Data[Amount].Name) else print(Name .. "'s data has failed to be saved. Data of " .. Data[Amount].Name) end end end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 16 Nov 2014 06:38 PM |
| I heard using UpdateAsync instead of SetAsync will fix that. |
|
|
| Report Abuse |
|
|
ZeveI
|
  |
| Joined: 29 Sep 2012 |
| Total Posts: 8003 |
|
|
| 16 Nov 2014 06:39 PM |
I'd help but i can't script :( nobody will help me fix this script for me ;c
function GetPlayerFromWeld(weld) if weld.Part1 ~= nil then local character = weld.Part1.Parent if character then local player = game.Players:GetPlayerFromCharacter(character) if player then return player end end end return nil end
seat.ChildAdded:connect(function(newChild) if newChild:IsA("Weld") then script.Sound:Play() local helicopter = script.parent.parent repeat wait() until helicopter wait(.2) helicopter.Blade1.Transparency = 1 helicopter.Blade2.Transparency = 1 helicopter.Blade3.Transparency = 1 helicopter.Blade4.Transparency = 1 helicopter.Decal1.Decal1.Transparency = 0 helicopter.Decal1.Decal2.Transparency = 0 helicopter.Decal2.Decal1.Transparency = 0 helicopter.Decal2.Decal2.Transparency = 0
local player = GetPlayerFromWeld(newChild) if player then script.Sound:Play() local helicopter = script.parent.parent repeat wait() until helicopter wait(.2) helicopter.Blade1.Transparency = 1 helicopter.Blade2.Transparency = 1 helicopter.Blade3.Transparency = 1 helicopter.Blade4.Transparency = 1 helicopter.Decal1.Decal1.Transparency = 0 helicopter.Decal1.Decal2.Transparency = 0 helicopter.Decal2.Decal1.Transparency = 0 helicopter.Decal2.Decal2.Transparency = 0 end end
seat.ChildRemoved:connect(function(oldChild) if oldChild:IsA("Weld") then do local helicopter = script.parent.parent repeat wait() until helicopter wait(.2) helicopter.Blade1.Transparency = 0 helicopter.Blade2.Transparency = 0 helicopter.Blade3.Transparency = 0 helicopter.Blade4.Transparency = 0 helicopter.Decal1.Decal1.Transparency = 1 helicopter.Decal1.Decal2.Transparency = 1 helicopter.Decal2.Decal1.Transparency = 1 helicopter.Decal2.Decal2.Transparency = 1
local player = GetPlayerFromWeld(oldChild) if player then script.Sound:Pause() end end end end end)
कोओल बेअन्स म्8 ओw अरे उ तोदज दो उ लिके म्ज सिग्ग्ज फ्र्न्द्? | cool beans m8 how are u today do u like my siggy frnd? |
|
|
| Report Abuse |
|
|