You can write your topic however you want, but you need to answer these questions:
-
I tried to sue tonumber and tostring both didn’t work
-
I got “Unable to cast value to object” error
-
i tried chatgpt and devforum but nothing i can get
local dataStoreService = game:GetService("DataStoreService")
local playerData = dataStoreService:GetDataStore("ashsgfjhlsfvjsafv")
local LoadEvent = script.Load.Event.Value
game.Players.PlayerAdded:Connect(function(player)
local MainTheme = workspace.MainTheme:Clone()
MainTheme.Parent = player
MainTheme.Playing = false
local Playing = Instance.new("BoolValue")
Playing.Parent = player
Playing.Value = false
Playing.Name = "Playing"
local CheckPoint = Instance.new("IntValue")
CheckPoint.Name = "CheckPoint"
CheckPoint.Parent = player
--here is the error
CheckPoint.Value = playerData:GetAsync(player.UserId, player.CheckPoint.Value) or 0
--ends here
end)
game.Players.PlayerRemoving:Connect(function(player)
playerData:SetAsync(player.UserId, player.CheckPoint.Value)
print(player.CheckPoint.Value)
end)