|
| 21 Oct 2017 04:42 PM |
Hi! I have a saving script for my pets to see if the player has a pet. I resetted all the data by changing the key from "id-"..plr.UserId to "userId-"..plr.UserId to make sure that I didn't have the data I had ###o####### ###seems whenever I join the game the BoolValue just turns to true. I don't know why. Here's the script:
local DSService = game:GetService("DataStoreService"):GetDataStore("STMProd") game.Players.PlayerAdded:connect(function(player) local key = "userIdValue-"..player.userId local folder = Instance.new("Folder",player) folder.Name = "Pets" local hasNeonPet = Instance.new("BoolValue",folder) hasNeonPet.Name = "hasNeonPet" hasNeonPet.Value = false --------------------Saving Data --------------------- local save = DSService:GetAsync(key) if save then hasNeonPet.Value = save[1] else local saveValue = {hasNeonPet.Value} DSService:SetAsync(key, saveValue) end end)
game.Players.PlayerRemoving:connect(function(plr) local key = "userIdValue-"..plr.userId local saves = {plr.Pets.hasNeonPet.Value} DSService:SetAsync(key, saves) end)
Thanks for any help ;) |
|
|
| Report Abuse |
|
|
| 21 Oct 2017 04:43 PM |
| The hashtags are just saying something like "so it didn't have the data I saved before." |
|
|
| Report Abuse |
|