Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to store int values in a folder for each player, that won't reset when they die? (Answered)

Asked by 4 years ago
Edited 4 years ago

So, I tried making a folder and putting lots of int values in it. I've tried changing them and some other stuff, but whenever I reset it resets them back to normal. Is there a way to keep the values the same, even if they die? I need different values for each player, not just one shared for all players. Wait, could I just put them in a gui, or would they reset when the player dies? I dont want datastore.

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago
--[[Put that script on ServerScriptService, get your folder with the IntValues and Rename it to
 "Data" and put it inside the script]]--

Players = game:GetService("Players") --Get players service.

Players.PlayerAdded:Connect(function(player) --Do a function when a player is added.
    local Data = script:WaitForChild("Data"):Clone()  --Will make a copy of the data folder
        if player then  --It will check if the player exists.
        Data.Parent = player --It will insert the folder inside the player
        end
end)

It will Clone your Data folder to the player that can be found inside game.Players[PlayerName]. as i remember it should not reset the values when player respawn.

Used: PlayerAdded

0
Oh, great idea. zandefear4 90 — 4y
0
It seems to work, thanks! zandefear4 90 — 4y
Ad

Answer this question