Skip to content

Instantly share code, notes, and snippets.

@Gabys2005
Last active June 17, 2023 12:49
Show Gist options
  • Save Gabys2005/967df15466197af1d24333f31cb227f1 to your computer and use it in GitHub Desktop.
Save Gabys2005/967df15466197af1d24333f31cb227f1 to your computer and use it in GitHub Desktop.
Import a StacyPilot recording without the plugin
local dss = game:GetService("DataStoreService")
local ds = dss:GetDataStore("StacyPilot")
local function stringify(data)
local final = "return {\n"
for _, v in data do
local toAdd = "\t{Time = " .. v.Time .. ", Data = {"
for _, b in v.Data do
local t = b[1]
local v = b[2]
print(t)
if t == "s" then
toAdd = toAdd .. '"' .. v .. '"'
elseif t == "n" then
toAdd = toAdd .. v
elseif t == "b" then
toAdd = toAdd .. tostring(v)
elseif t == "c" then
local color = Color3.fromHex(v)
toAdd = toAdd .. "Color3.fromRGB(" .. math.round(color.R * 255) .. ", " .. math.round(color.G * 255) .. ", " .. math.round(color.B * 255) .. ")"
elseif t == "v" then
local split = string.split(v, " ")
toAdd = toAdd .. "Vector3.new(" .. split[1] .. ", " .. split[2] .. ", " .. split[3] .. ")"
elseif t == "cs" then
toAdd = toAdd .. "ColorSequence.new({"
local splitKeypoints = string.split(v, " ")
for i, keypoint in splitKeypoints do
local split = string.split(keypoint, ":")
local color = Color3.fromHex(split[2])
toAdd = toAdd .. `ColorSequenceKeypoint.new({split[1]}, Color3.fromRGB({math.round(color.R * 255)}, {math.round(color.G * 255)}, {math.round(color.B * 255)})){if i == #splitKeypoints then "" else ", "}`
end
toAdd = toAdd .. "})"
else
toAdd = toAdd .. "nil"
end
toAdd = toAdd .. "; "
end
if v.Data[1] then
toAdd = string.sub(toAdd, 1, #toAdd - 2)
end
toAdd = toAdd .. "}};\n"
final = final .. toAdd
end
final = final .. "}"
return final
end
local function import(name)
local saves = ds:GetAsync(name)
local folder = Instance.new("Folder")
folder.Name = name
folder.Parent = workspace.StacyPilot.Recordings
for i,v in pairs(saves) do
local data = ds:GetAsync(name.."-"..v)
print("Loading",v)
local module = Instance.new("ModuleScript")
module.Name = v
module.Source = stringify(data)
module.Parent = folder
end
end
import("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment