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

How to fix datastore not sending when player leaves?

Asked by
Meqolo 78
6 years ago

I'm making a jail system and for some reason my datastore just refuses to work when the player leaves, it works every other time though.

Code:

game.Players.PlayerRemoving:Connect(function(plr)
    print("a")
    print(game:GetService("ReplicatedStorage").ArrestTimes[plr.Name].Value)
    ArrestDS:SetAsync(plr.Name .. ":" .. plr.UserId,        game:GetService("ReplicatedStorage").ArrestTimes[plr.Name].Value)
    print("hi")
    print(ArrestDS:GetAsync(plr.Name .. ":" .. plr.UserId))
    print("hi")
end)

1 answer

Log in to vote
0
Answered by 6 years ago

Wasn't able to fix this, And couldn't really bother too. I redid it and not sure if it works. But an issu

game.Players.PlayerRemoving:connect(function(plr)
    local TimesArrested = game:GetService(ReplicatedStorage").ArrestTimes[plr.Name].Value
    print(plr.Name .. "Left, Saving stats, Times Arrest: " .. TimesArrested)
    ArrestDS:SetAsync(plr.Name .. ":" .. plr.UserId, TimesArrested
    print("Succesfully saved the stats of the player : " .. plr.Name)
end)
Ad

Answer this question