One warning: Data stores cannot be tested in Studio, unless you have Studio API checked.
Should be looking like this in the settings page:
Enable Studio Access to API Services: [ ]
Else, it will error.
One warning: Data stores cannot be tested in Studio, unless you have Studio API checked.
Should be looking like this in the settings page:
Enable Studio Access to API Services: [ ]
Else, it will error.
The instance is named below the creation of the donate IntValue. The highlighted line of code is bad practice anyway, setting properties after the objectâs been attached to the DataModel is inefficient if done where not needed to.
Please donât put the code that defines the function of Donate.OnServerInvoke in the PlayerAdded event. Every time a player joins, the function gets overwritten with a new one.
Also:
Thatâs in your recent code. Two lines below it, you parent the value again. Just wanted to point that out for you.
Just a note that while reading through this thread, you should also be trying to learn and take some lessons from the code youâre getting. Scripting Support is not necessarily a place to ask for free code. There are some issues that you can debug yourself; please donât copy and paste a script into Studio, then come back without attempting any fixes and say that itâs not working.
Also, in terms of getting leaderstats to show, I think you just need to change the order in which youâre parenting things. Instead of parenting the stats folder immediately after creating it, parent it after youâve created and parented the rest of your data values.
I do not understand ââ Could you (if you do not mind) translate this into âFrentchâ because I do not have to understand
Donât know French myself but I consider Google Translate a great friend. You should be able to get a general idea from this translation:
Notez simplement quâen lisant ce fil, vous devriez Ă©galement essayer dâapprendre et de tirer quelques leçons du code que vous obtenez. Lâassistance de script nâest pas nĂ©cessairement un endroit pour demander un code gratuit. Il existe certains problĂšmes que vous pouvez rĂ©soudre vous-mĂȘme. veuillez ne pas copier et coller un script dans Studio, puis revenir sans essayer de solutionner et dire que cela ne fonctionne pas.
De plus, sâagissant de lâaffichage des dirigeants, je pense que vous devez simplement modifier lâordre dans lequel vous dirigez les choses. Au lieu de gĂ©rer le dossier de statistiques immĂ©diatement aprĂšs lâavoir crĂ©Ă©, parentz-le aprĂšs avoir crĂ©Ă© et parentĂ© le reste de vos valeurs de donnĂ©es.
I tried a different solution before coming on the form I just do not know how to do it anymore
i patch my problem code is
local DataStoreService = game:GetService(âDataStoreServiceâ)
local myDataStore = DataStoreService:GetDataStore(âmyDataStoreâ)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Points = Instance.new("IntValue")
Points.Name = "Points"
Points.Parent = leaderstats
local data
local success, errormessage = pcall(function()
data = myDataStore:GetAsync(player.UserId.."-points")
end)
if success then
Points.Value = data
else
print("ERROR DATA NOT SAVED")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
myDataStore:SetAsync(player.UserId.."-points",player.leaderstats.Points.Value)
end)
if success then
print("Player data saved !")
else
print("Error data not saved")
end
end)
For future posts please follow the guidelines: