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

Is it possible to save data in a leaderboard inside a player?

Asked by 6 years ago

I want to save some parameters from some objects that I need to compare, but I dont want that the leaderboard to actually appear on the players screen, but to be inside the player to manipulate the leaderboard without the player knowing it.

The folder that is being created inside the player is called "Hidden" but when I exit from the game and come back in, the data is not being saved in the Data Store.



local Datastore = game:GetService("DataStoreService") local ds2 = Datastore:GetDataStore("Salto") local ds3 = Datastore:GetDataStore("Velocidad") local ds4 = Datastore:GetDataStore("Dash") local ds5 = Datastore:GetDataStore("2Dash") local ds6 = Datastore:GetDataStore("3Dash") local ds7 = Datastore:GetDataStore("Dash60") local ds8 = Datastore:GetDataStore("DobleSalto30") local ds9 = Datastore:GetDataStore("DobleSaltoInf") local ds10 = Datastore:GetDataStore("Tags") local ds11 = Datastore:GetDataStore("Invisibilidad") local ds12 = Datastore:GetDataStore("Velocidad25") game.Players.PlayerAdded:connect(function(player) --local player.UserId = "user_" .. player.UserId local stats1 = Instance.new("Folder",player) stats1.Name = "Hidden" local pSalto = Instance.new("IntValue", stats1) pSalto.Name = "pSalto" local pVelocidad = Instance.new("IntValue", stats1) pVelocidad.Name = "pVelocidad" local pDash = Instance.new("IntValue", stats1) pDash.Name = "pDash" local p2Dash = Instance.new("IntValue", stats1) p2Dash.Name = "p2Dash" local p3Dash = Instance.new("IntValue", stats1) p3Dash.Name = "p3Dash" local pDash60 = Instance.new("IntValue", stats1) pDash60.Name = "pDash60" local pDoble30 = Instance.new("IntValue", stats1) pDoble30.Name = "pDoble30" local pDobleInf = Instance.new("IntValue", stats1) pDobleInf.Name = "pDobleInf" local pTags = Instance.new("IntValue", stats1) pTags.Name = "pTags" local pInvisibilidad = Instance.new("IntValue", stats1) pInvisibilidad.Name = "pInvisibilidad" local pVelocidad25 = Instance.new("IntValue", stats1) pVelocidad25.Name = "pVelocidad25" pSalto.Parent = game.Players.LocalPlayer.Hidden pVelocidad.Parent = game.Players.LocalPlayer.Hidden pDash.Parent = game.Players.LocalPlayer.Hidden p2Dash.Parent = game.Players.LocalPlayer.Hidden p3Dash.Parent = game.Players.LocalPlayer.Hidden pDash60.Parent = game.Players.LocalPlayer.Hidden pDoble30.Parent = game.Players.LocalPlayer.Hidden pDobleInf.Parent = game.Players.LocalPlayer.Hidden pTags.Parent = game.Players.LocalPlayer.Hidden pVelocidad25.Parent = game.Players.LocalPlayer.Hidden pInvisibilidad.Parent = game.Players.LocalPlayer.Hidden pSalto.Value = ds2:GetAsync(player.UserId) or 0 pVelocidad.Value = ds3:GetAsync(player.UserId) or 0 pDash.Value = ds4:GetAsync(player.UserId) or 0 p2Dash.Value = ds5:GetAsync(player.UserId) or 0 p3Dash.Value = ds6:GetAsync(player.UserId) or 0 pDash60.Value = ds7:GetAsync(player.UserId) or 0 pDoble30.Value = ds8:GetAsync(player.UserId) or 0 pDobleInf.Value = ds9:GetAsync(player.UserId) or 0 pTags.Value = ds10:GetAsync(player.UserId) or 0 pInvisibilidad.Value = ds11:GetAsync(player.UserId) or 0 pVelocidad25.Value = ds12:GetAsync(player.UserId) or 0 pSalto.Changed:connect(function(player) print('Guardando datos') ds2:SetAsync(player.UserId,pSalto.Value) end) pVelocidad.Changed:connect(function(player) print('Guardando datos') ds3:SetAsync(player.UserId,pVelocidad.Value) end) pDash.Changed:connect(function(player) print('Guardando datos') ds4:SetAsync(player.UserId,pDash.Value) end) p2Dash.Changed:connect(function(player) print('Guardando datos') ds5:SetAsync(player.UserId,p2Dash.Value) end) p3Dash.Changed:connect(function(player) print('Guardando datos') ds6:SetAsync(player.UserId,p3Dash.Value) end) pDash60.Changed:connect(function(player) print('Guardando datos') ds7:SetAsync(player.UserId,pDash60.Value) end) pDoble30.Changed:connect(function(player) print('Guardando datos') ds8:SetAsync(player.UserId,pDoble30.Value) end) pDobleInf.Changed:connect(function(player) print('Guardando datos') ds9:SetAsync(player.UserId,pDobleInf.Value) end) pTags.Changed:connect(function(player) print('Guardando datos') ds10:SetAsync(player.UserId,pTags.Value) end) pInvisibilidad.Changed:connect(function(player) print('Guardando datos') ds11:SetAsync(player.UserId,pInvisibilidad.Value) end) pVelocidad25.Changed:connect(function(player) print('Guardando datos') ds12:SetAsync(player.UserId,pVelocidad25.Value) end) end) game.Players.PlayerRemoving:connect(function(player) print('Guardando datos de powerups') --local player.UserId = "user_" .. player.UserId ds2:SetAsync(player.UserId,player.Hidden.pSalto.Value) ds3:SetAsync(player.UserId,player.Hidden.pVelocidad.Value) ds4:SetAsync(player.UserId,player.Hidden.pDash.Value) ds5:SetAsync(player.UserId,player.Hidden.p2Dash.Value) ds6:SetAsync(player.UserId,player.Hidden.p3Dash.Value) ds7:SetAsync(player.UserId,player.Hidden.pDash60.Value) ds8:SetAsync(player.UserId,player.Hidden.pDoble30.Value) ds9:SetAsync(player.UserId,player.Hidden.pDobleInf.Value) ds10:SetAsync(player.UserId,player.Hidden.pTags.Value) ds11:SetAsync(player.UserId,player.Hidden.pInvisibilidad.Value) ds12:SetAsync(player.UserId,player.Hidden.pVelocidad25.Value) end)

Can someone help me out with this? Thanks a lot!

0
a LocalPlayer is nil on the server. And please indent your code and put some inside functions . User#19524 175 — 6y

Answer this question