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

my friend needs help with this datastore? [closed]

Asked by 8 years ago
--[[
    Hunger,Thirst,Health
--]]
wait()
local Data = game:GetService("DataStoreService")
local HungerValue = Data:GetDataStore("8432345EKF")
local ThirstValue = Data:GetDataStore("83924355KJ")
local HealthValue = Data:GetDataStore("38533456KD")
name = "PurelyMystic"
pls = game.Players:GetUserIdFromNameAsync(name)
print(HealthValue:GetAsync(pls))
game.Players.PlayerAdded:connect(function(plr)
    print("Joined")
    local folder = Instance.new("Folder", plr)
    local hunger = Instance.new("IntValue", folder)
    local thirst = Instance.new("IntValue", folder)
    local health = Instance.new("IntValue", folder)
    folder.Name = "Stats"
    hunger.Name = "Hunger"
    thirst.Name = "Thirst"
    health.Name = "Health"
    hunger.Value = HungerValue:GetAsync(plr.userId) or 100
    thirst.Value = ThirstValue:GetAsync(plr.userId) or 100
    health.Value = HealthValue:GetAsync(plr.userId) or 100
end)
game.Players.PlayerRemoving:connect(function(plr)
    local stat = plr.Stats
    HungerValue:SetAsync(plr.userId, stat.Hunger.Value)
    ThirstValue:SetAsync(plr.userId, stat.Thirst.Value)
    HealthValue:SetAsync(plr.userId, stat.Health.Value)
end)

1
Please make sure you're asking questions that benefit *you*, and help *you* better understand something. This isn't a request site, and you should not be asking "do the work for me" questions. ScriptGuider 5640 — 8y

Closed as Not Constructive by ScriptGuider and User#6546

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?