I made a simple GlobalDataStore script but I'm wondering how I would go about making the saved leaderstat value behave normally as if it was saved, while resetting the data to zero for the player whenever they join? Heres my attempt at making the datastore script do the above:
local DataStore = game:GetService("DataStoreService"):GetDataStore("CoolDataStore")
local function Added(Player)
local LS = Instance.new("Folder",Player)
LS.Name = "leaderstats"
local Stage = Instance.new("NumberValue", LS)
Stage.Name = "Points"
end
game.Players.PlayerRemoving:Connect(function(Player)
Data:SetAsync(Player.UserId, Player.leaderstats.Point.Value)
end)
game.Players.PlayerAdded:Connect(Added)
Help would be much appreciated, thanks!

1 comment
Please explain what you're doing. How will OP learn?