#Why is this DataStore returning "Instance"

1 messages · Page 1 of 1 (latest)

mighty swan
#

i have this script and its the only script that touches this checkpoints datastore

local DSS = game:GetService("DataStoreService")
local players = game:GetService("Players")
local checkSaves = DSS:GetDataStore("CheckSaves")
local checkpoints = workspace:WaitForChild("Checkpoints")
local event = game:GetService("ReplicatedStorage"):WaitForChild("Level")
local loadedFine = false
local checkNum = 0
local char
local plr

local function load()
    local tries = 0
    local maxtries = 3
    local getSuccess, getResponse
    repeat
        getSuccess, getResponse = checkSaves:GetAsync("CPoint_"..plr.UserId)
        tries += 1
    until getSuccess or tries == maxtries
    if getSuccess then
        print("getResponse type:", typeof(getResponse), getResponse)
        loadedFine = true
        local _, size = char:GetBoundingBox()
        if getResponse and getResponse ~= 1 and getResponse ~= 0 then checkNum = getResponse else checkNum = 1 end
        local checkpoint = checkpoints:WaitForChild(tostring(checkNum))
        char:MoveTo(checkpoint.Position + Vector3.new(0, checkpoint.Size.Y/2 + size.Y/2, 0))
        event:FireClient(plr, checkNum)
    else
        warn("get", getResponse)
        checkNum = 1
        local checkpoint = checkpoints:WaitForChild(tostring(checkNum))
        char:MoveTo(checkpoint.Position + Vector3.new(0, checkpoint.Size.Y/2 + size.Y/2, 0))
        event:FireClient(plr, checkNum)
    end
end
#

im trying to send the rest of the code and its not letting me

hushed dust
#

You might have accidentally set an incorrect test value under "CPoint_"..plr.UserId
Since datastore can not store instances. Try resetting your data

mighty swan
#

i used a diff datasotre - CheckPoint_userID - and it did the same thing