Hello, I’m trying to make the script save a player’s prison time, which is an IntValue inside of their Player, however, it doesn’t seem to be working and I’m getting error: “GetAsync/SetAsync is not a valid member of IntValue”
local Store = DSS:GetDataStore("Prison")
-- Checks if player has prison time
game.Players.PlayerAdded:Connect(function(Player)
spawn(function()
while task.wait(1) do
if Player:FindFirstChild("PrisonTime") then
local Data = Player:FindFirstChild("PrisonTime")
local OriginalTeam = Player.Team
if Data then
Data:GetAsync(Player.UserId)
Player:FindFirstChild("PrisonTime").Value -= 1
if Player:FindFirstChild("PrisonTime").Value >= 1 then
spawn(function()
task.wait(.5)
if Player.Team ~= game.Teams.Jailed then
Player.Team = game.Teams.Jailed
task.wait(.5)
Player:LoadCharacter()
end
end)
end
else
Player.Team = OriginalTeam
Player:WaitForChild("PrisonTime"):Destroy() -- Destroy Value
end
end
end
end)
end)
game.Players.PlayerRemoving:Connect(function(Player)
if Player:FindFirstChild("PrisonTime") then
local Data = Player:FindFirstChild("PrisonTime")
Data:SetASync(Player.UserId, Data.Value)
end
end)