local starterValue = game.ReplicatedStorage.Ladder
local currentStat = script.Name
local statFolder = "leaderboard"
game.Players.PlayerAdded:Connect(function(plr)
local currentDatastore = datastoreModule(string.lower(script.Name), plr)
repeat wait()
until plr:FindFirstChild(statFolder) and plr:FindFirstChild(statFolder):FindFirstChild(currentStat)
local function updateStat(updatedValue)
plr:FindFirstChild(statFolder):FindFirstChild(currentStat).Value = updatedValue
end
if currentDatastore:Get() == nil then
updateStat(starterValue)
else
currentDatastore:OnUpdate(updateStat(currentDatastore:Get()))
end
plr:FindFirstChild(statFolder):FindFirstChild(currentStat):GetPropertyChangedSignal("Value"):Connect(function()
currentDatastore:Set(plr:FindFirstChild(statFolder):FindFirstChild(currentStat).Value)
end)
end)```
It gives me this error: Unable to assign property Value. Object expected, got string - Server - Ladder:16
Ladder is the name of the script
#Object Value DataStore2
56 messages · Page 1 of 1 (latest)
** You are now Level 10! **
:0
xd
@boreal sequoia what line is line 17?
plr:FindFirstChild(statFolder):FindFirstChild(currentStat).Value = updatedValue
i put rwong number it was 16
anyways this is line 16
wha
https://www.youtube.com/watch?v=wBobROFO6a8&t i watched this tutorial and tried making it an object value instead of string value
In this video, I will be teaching all of you how to save numbers, strings, and tables to DATASTORE 2 in Roblox Studio!
Intro video on Datastore 2: https://www.youtube.com/watch?v=Z9L1cA0eZaE
Datastore2 Model: https://www.roblox.com/library/1936396537/DataStore2-Data-Loss-Prevention-and-Caching
Join this channel to get special access to perks...
So you tried to save an object in a datastore?
Doesn’t matter
Scripts don't have a Value property in the first place so currentstat is not a script?
How are you planning on putting an object inside a table?
currentstat is the name of the script
(Which gets replicated across servers)
idk
I recommend storing all of the assets the player is able to save in the RS
Then save the name
i dont know what im doing i never messed with datastores
plr:FindFirstChild(statFolder):FindFirstChild(currentStat).Value = updatedValue
In this line, you're getting .Value from currentStat right?
yes
And currentStat is a script?
Is CurrentStat a script?
name of the script
I am pretty sure currentStat is not a script. The naming doesn't sound like it is and the fact it's not giving a error despite accessing "Value" property which it doesn't have
.Value or a script doesn’t exist
Try removing .Value and see if it works. Since it won't take string and a object instead
Let me explain better what im trying to do, In my steep steps fangame i wanna save ladder skin so you dont have to go and equip it everytime so i just try to save a value on the player with the ladder he equipped and then when he joins get the value and put it in the value of the skin(the value on the image)
Try this and tell me if it works or gives a different error
ok
ServerScriptService.Datastore2.StatSaving.Ladder:16: Expected identifier when parsing expression, got '='
You probably have a extra paranthesis
where?
plr:FindFirstChild(statFolder):FindFirstChild(currentStat).Value = updatedValue
can u show the line?
i added back .Value
Ok don't, show me the new one
plr:FindFirstChild(statFolder):FindFirstChild(currentStat) = updatedValue
this line gives this error
hmm
it is a syntax error so hmm
Maybe u have a extra paranthesis somewhere else in the code
you know what frick it if the lazy people dont wanna equip their ladder everytime they die or join the game then stop playing, this annoyed me enough
lol