Hello, so here is my script so far:
local dataStoreService = game:GetService("DataStoreService")
local timeData = dataStoreService:GetDataStore(script.DataStorageName.Value)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local timeInGame = Instance.new("IntValue")
timeInGame.Name = "Minutes"
timeInGame.Value = timeData:GetAsync(player.UserId) or 0
timeInGame.Parent = leaderstats
timeInGame.Changed:Connect(function()
timeData:SetAsync(player.UserId,timeInGame.Value)
end)
local timeReset = {
player.leaderstats.Minutes.Value
}
player.Chatted:Connect(function(msg)
if msg == "!RestartTime" then
-- Remove all data Script here.
end
end)
end)
I’m not aware of how to reset everyone’s data depending if they’re in the server are not, but I’m trying to get it to whenever the player says “!RestartTime” everyone’s data clears, so where it says “-- Remove all data Script here”. Can someone tell me how I can write this script here to remove everyone’s data whether they’re in game or not.
Thanks for reading!