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

DataStores Problem it wont work at all.. Why wont this Work?

Asked by 7 years ago

i dont have a clue what is wrong here at all!!!

ive been trying for ages ;(

data = game:GetService("DataStoreService")
save = data:GetDataStore("Tools")


game.Players.PlayerAdded:connect(function(player)
    k = player.Backpack:WaitForChild("BDtest")
    k.Value = save:GetAsync(player.UserId) or 0
    save:SetAsync(player.UserId, k.Value)
    game.Players:WaitForChild(player)
    k.Changed:connect(function()
        save:SetAsync(player.UserId, k.Value)
    end)
    if k.Value == 1 then
        game.ReplicatedStorage.vamp["Blood Drain"]:Clone().Parent = player:WaitForChild("Backpack")
        player.Backpack["Stone Mask"]:Destroy()
        save:SetAsync(player.UserId, k.Value)
    end
end)



game.Players.PlayerRemoving:connect(function(player)
    local k = player.Backpack:WaitForChild("BDtest")    
    save:SetAsync(player.UserId, k.Value)
    if k.Value == 1 then
        save:SetAsync(player.UserId, k.Value)
    end
end)
0
tried print debugging? abnotaddable 920 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Hey,

Not an idea whether this will work or not but I mean, I can try to help.

Have you tried for example on line 7:

    k.Value = save:GetAsync(tostring(player.UserId)) or 0

Probably won't work but I mean, give it a shot if you want.

Sam

0
stupid feggot JohnJohniamm55 21 — 7y
Ad

Answer this question