You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I am attempting to wipe my data stores but the clear ache function does nothing.
- What is the issue? Include screenshots / videos if possible!
I get no error but the ds2 does not clear my data and it still loads my old one.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have called it from the command line and still nothing works.
here is my code. Some of the bottom is misssing as that is just used for my pets and does not use any datastore methods so I am just cuttin it out for now. The top of the code is also cut off since that is also full of non data stuff but the datastore2 variable is there.
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
DataStore2.ClearCache()
local Clone = ServerStorage:WaitForChild("Slots"):Clone()
Clone.Parent = char
Clone.Root.CFrame = char.HumanoidRootPart.CFrame
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = Clone.Root
Weld.Part1 = char.HumanoidRootPart
Weld.Parent = char.HumanoidRootPart
local PetsFolder = Instance.new("Folder")
PetsFolder.Parent = player.Character
PetsFolder.Name = "PetsFolder"
local GlobalPetStorage = Instance.new("IntValue")
GlobalPetStorage.Value = DataStore2("TestGlobalPetStorage", player):Get(4)
GlobalPetStorage.Name = "GlobalPetStorage"
GlobalPetStorage.Parent = player:WaitForChild("HiddenStats")
local LocalPetStorage = Instance.new("IntValue")
LocalPetStorage.Value = GlobalPetStorage.Value
LocalPetStorage.Name = "LocalPetStorage"
LocalPetStorage.Parent = player:WaitForChild("HiddenStats")
local GlobalPetInventory = Instance.new("IntValue")
GlobalPetInventory.Value = DataStore2("TestGlobalPetInventory", player):Get(10)
GlobalPetInventory.Name = "GlobalPetInventory"
GlobalPetInventory.Parent = player:WaitForChild("HiddenStats")
local LocalPetInventory = Instance.new("IntValue")
LocalPetInventory.Value = GlobalPetInventory.Value
LocalPetInventory.Name = "LocalPetInventory"
LocalPetInventory.Parent = player:WaitForChild("HiddenStats")
local OwnedPets = Instance.new("StringValue")
OwnedPets.Name = "PetsOwned"
OwnedPets.Value = DataStore2("TestPetStore", player):Get(HttpService:JSONEncode({}))
OwnedPets.Parent = player:WaitForChild("HiddenStats")
local CurrentSlots = Instance.new("StringValue")
CurrentSlots.Name = "CurrentSlots"
CurrentSlots.Value = DataStore2("TestSlotStore", player):Get(DefaultSlotTable)
CurrentSlots.Parent = player:WaitForChild("HiddenStats")
GlobalPetInventory.Changed:Connect(function()
UpdateLocalInv(player, LocalPetInventory ,GlobalPetInventory)
end)
GlobalPetStorage.Changed:Connect(function()
UpdateLocalStorage(player, LocalPetStorage, GlobalPetStorage)
end)
OwnedPets.Changed:Connect(function()
DataStore2("TestPetStore", player):Set(OwnedPets.Value)
end)
CurrentSlots.Changed:Connect(function()
DataStore2("TestSlotStore", player):Set(CurrentSlots.Value)
end)
GlobalPetStorage.Changed:Connect(function()
DataStore2("TestGlobalPetStorage", player):Set(GlobalPetStorage.Value)
end)
GlobalPetInventory.Changed:Connect(function()
DataStore2("TestGlobalPetInventory", player):Set(GlobalPetInventory.Value)
end)
DataStore2.Combine("TestKey", "TestPetStore", "TestSlotStore", "TestGlobalPetStorage", "TestGlobalPetInventory")