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

Why won't my datastore and simulator work?

Asked by 3 years ago
Edited 3 years ago

I have tried the script! I found it on YouTube and the code is placed in the correct way.

Everything after this is the script vvv

local datatstore= game:GetService("DataStoreService"):GetDataStore("Divine")

game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Parent = player leaderstats.Name = "leaderstats"

local power = Instance.new("NumberValue")
power.Parent = leaderstats
power.Name = "Decoin"

local cash = Instance.new("NumberValue")
cash.Parent = leaderstats
cash.Name = "Decoy"

local key = "user-"..player.UserId

local storeditems = datastore:GetAsync(key)

if storeditems then
    power.Value = storeditem[1]
    cash.Value = storeditem[2]
else
    local items = {power.Value, cash.Value}

    datastore:SetAsynce(key, items)

end

end)

game.Players.PlayerRemoving:Connect(function(player) local item = {player.leaderstats.Power, player.leaderstats.Cash.Value} end)

0
local datatstore= game:GetService("DataStoreService"):GetDataStore("Divine") game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Parent = player leaderstats.Name = "leaderstats" local power = Instance.new("NumberValue") power.Parent = leaderstats power.Name = "Decoin" Local cash = Instance.new("NumberValue") cash.Parent = leaderstat PikachuPlayz9_YT 0 — 3y
0
In the player removing event. You aren't adding player.leaderstats.Power.Value . I think you forgot the value part. Soban06 410 — 3y

Answer this question