dev_Typ
(Typ)
March 2, 2022, 1:06am
#1
Hey, for some reason my datastore script for character customization works perfectly fine for me in studio, but not in-game. Anyone know why this is the case? The (server) script works by getting when the player joins and when their character is added. Below are pictures of what it looks like in studio vs. in-game.
EDIT: REDACTED SCRIPT
In studio -
In-game -
daulric
(Ulric)
March 2, 2022, 1:08am
#2
did u do a player removing function like setaync when the player leaves the game.
daulric
(Ulric)
March 2, 2022, 1:11am
#3
game.Players.PlayerRemoving:Connect (function(player)
ds:SetAync(player.UserId.."Something", clothes) -- what ever is the code juzt an example.
end)
sorey for the bad explaination btw
daulric
(Ulric)
March 2, 2022, 1:12am
#4
do this on a phone! also add the function to the playeradded function.
Summary
This text will be hidden
dev_Typ
(Typ)
March 2, 2022, 1:51am
#5
it already has saved data @daulric
Forummer
(Forummer)
March 2, 2022, 2:03am
#6
You should probably provide the script(s) you’re working with for better assistance.
dev_Typ
(Typ)
March 2, 2022, 2:09am
#7
done
onlythirtycharactersisokay
Forummer
(Forummer)
March 2, 2022, 2:10am
#8
local d = data:GetDataStore("ClothingDataStore")
Nothing is done with d
. There are no calls to GetAsync()
or SetAsync()
.
dev_Typ
(Typ)
March 2, 2022, 2:11am
#9
there are, i removed them from the post… ill put them 1 sec
dev_Typ
(Typ)
March 2, 2022, 2:13am
#10
some parts of the scripts i removed (hence it says --redacted)
i put that back for you to see
dev_Typ
(Typ)
March 2, 2022, 2:14am
#11
as you can see here-
there is data for the user (me)
Forummer
(Forummer)
March 2, 2022, 2:15am
#12
There’s still no SetAsync()
call, which is required to store data in the datastore.
dev_Typ
(Typ)
March 2, 2022, 2:15am
#13
thats a different script
dataStore:SetAsync(player.UserId.."-asdjklasjdlkajs", game:GetService("HttpService"):JSONEncode(store))
Forummer
(Forummer)
March 2, 2022, 11:02am
#14
JSONEncode()
returns a JSON formatted string, when you subsequently load this data you need to call JSONDecode()
on it to convert it back into Lua table format.
dev_Typ
(Typ)
March 3, 2022, 1:03am
#15
it is decoded i just didnt send that part
dev_Typ
(Typ)
March 3, 2022, 1:09am
#16
never mind, I fixed it by adding a wait(1)
after the CharacterAdded
function.
1 Like