How can I clear a datastore?

UPDATE

I copied my game into a new place and it fixed my problem but it causes animation bugs. How can I clear a datastore

DATA MANAGER

local ProfileService = require(game.ReplicatedStorage.ProfileService)
local Players = game:GetService("Players")

local ProfileStore = ProfileService.GetProfileStore(
	"Player",
	{
		cash = 0;
		bank = 0;
		
		
		
		
	}
	
	
)

local Profiles = {}

local function playeradded(player)
	local profile = ProfileStore:LoadProfileAsync(
		"Player_" .. player.UserId,
		"ForceLoad"
	)
	if profile then
		profile:ListenToRelease(function()
			Profiles[player] = nil
			player:Kick("An error occured.")
		end)
		
		if player:IsDescendantOf(Players) then
			Profiles[player] = profile
			
		else
			profile:Release()
		end
	else
		player:Kick("An error occured.")
	end
end

local function playerremoving(player)
	local profile = Profiles[player]
	if profile then
		profile:Release()
	end
end
	
Players.PlayerAdded:Connect(playeradded)
Players.PlayerRemoving:connect(playerremoving)

local DataManager= {}


function DataManager:Get(player)
	local profile = Profiles[player]
	if profile then
		return profile.Data
	end
end
return DataManager

Adds Money

local DataManager = require(game.ReplicatedStorage.DataManager)
game.ReplicatedStorage.RemoteEvents.axcv.OnServerEvent:Connect(function(plr)
	local data = DataManager:Get(plr)
	if data then
		print(data.cash)
		data.cash += 50
	end

	
end)

It was my previous datastore interfering with the new one so I had to make a new place

I still need help with this. How do I clear all data in a datastore?

I believe you can just change the datastore’s name.

2 Likes