i have tried to make a saving system, but when testing, it says Datastore cant store arrays, but only valid UTF-8 characters. Why is this?
client:
script.Parent.MouseButton1Click:Connect(function()
local e = {}
local meshdat = {}
local wedgedat = {}
local blockdat = {}
local cydat = {}
local firedat = {}
local smokedat = {}
local pointlightdat = {}
local spotlightdat = {}
for i,v in pairs(game.Players.LocalPlayer.Cars.Current:GetChildren()) do
for _,m in pairs(game.Workspace.CurrentCamera.Car.Body:GetDescendants()) do
if m:IsA("Part") and m.Name ~= "Wedge" then
table.insert(
e,
{
["Name"] = m.Name;
["Color"] = m.BrickColor.Name;
["Anchored"] = m.Anchored;
["CanCollide"] = m.CanCollide;
["Transparency"] = m.Transparency;
["Material"] = m.Material;
["Reflectance"] = m.Reflectance;
["Shape"] = m.Shape;
["Pos"] = {
["X"] = m.CFrame.X;
["Y"] = m.CFrame.Y;
["Z"] = m.CFrame.Z;
["RX"] = m.Orientation.X;
["RY"] = m.Orientation.Y;
["RZ"] = m.Orientation.Z;
["XSize"] = m.Size.X;
["YSize"] = m.Size.Y;
["ZSize"] = m.Size.Z;
}
}
)
end
if m:IsA("WedgePart") then
table.insert(
wedgedat,
{
["Name"] = m.Name;
["Color"] = m.BrickColor.Name;
["Anchored"] = m.Anchored;
["PartType"] = m.ClassName;
["CanCollide"] = m.CanCollide;
["Transparency"] = m.Transparency;
["Material"] = m.Material;
["Reflectance"] = m.Reflectance;
["Pos"] = {
["X"] = m.CFrame.X;
["Y"] = m.CFrame.Y;
["Z"] = m.CFrame.Z;
["RX"] = m.Orientation.X;
["RY"] = m.Orientation.Y;
["RZ"] = m.Orientation.Z;
["XSize"] = m.Size.X;
["YSize"] = m.Size.Y;
["ZSize"] = m.Size.Z;
}
}
)
end
if m:IsA("SpecialMesh") then
table.insert(
meshdat,
{
["ParentPos"] = m.Parent.Position;
["MeshId"] = m.MeshId;
["Stuff"] = {
["ScaleX"] = m.Scale.X;
["ScaleY"] = m.Scale.Y;
["ScaleZ"] = m.Scale.Z;
["OffsetY"] = m.Offset.X;
["OffsetY"] = m.Offset.Y;
["OffsetY"] = m.Offset.Z;
}
}
)
end
if m:IsA("BlockMesh") then
table.insert(
blockdat,
{
["ParentPos"] = m.Parent.Position;
["Stuff"] = {
["ScaleX"] = m.Scale.X;
["ScaleY"] = m.Scale.Y;
["ScaleZ"] = m.Scale.Z;
["OffsetY"] = m.Offset.X;
["OffsetY"] = m.Offset.Y;
["OffsetY"] = m.Offset.Z;
}
}
)
end
if m:IsA("CylinderMesh") then
table.insert(
cydat,
{
["ParentPos"] = m.Parent.Position;
["Stuff"] = {
["ScaleX"] = m.Scale.X;
["ScaleY"] = m.Scale.Y;
["ScaleZ"] = m.Scale.Z;
["OffsetY"] = m.Offset.X;
["OffsetY"] = m.Offset.Y;
["OffsetY"] = m.Offset.Z;
}
}
)
end
if m:IsA("Fire") then
table.insert(
firedat,
{
["ParentPos"] = m.Parent.Position;
["Stuff"] = {
["Color"] = m.Color;
["Heat"] = m.Heat;
["Name"] = m.Name;
["SecondaryColor"] = m.SecondaryColor;
["Size"] = m.Size;
}
}
)
end
if m:IsA("Smoke") then
table.insert(
smokedat,
{
["ParentPos"] = m.Parent.Position;
["Stuff"] = {
["Color"] = m.Color;
["Opacity"] = m.Opacity;
["Name"] = m.Name;
["RiseVelocity"] = m.RiseVelocity;
["Size"] = m.Size;
}
}
)
end
if m:IsA("PointLight") then
table.insert(
pointlightdat,
{
["ParentPos"] = m.Parent.Position;
["Stuff"] = {
["Color"] = m.Color;
["Range"] = m.Range;
["Name"] = m.Name;
["Shadows"] = m.Shadows;
["Brightness"] = m.Brightness;
}
}
)
end
if m:IsA("SpotLight") then
table.insert(
spotlightdat,
{
["ParentPos"] = m.Parent.Position;
["Stuff"] = {
["Color"] = m.Color;
["Range"] = m.Range;
["Name"] = m.Name;
["Shadows"] = m.Shadows;
["Brightness"] = m.Brightness;
["Angle"] = m.Angle;
["Face"] = m.Face;
}
}
)
end
end
game.Workspace.PaintRemotes.AddCustomPart:FireServer(v,e,meshdat,blockdat,cydat,firedat,smokedat,pointlightdat,spotlightdat,wedgedat)
game.Workspace.PaintRemotes.SetStats:FireServer(v,game.Workspace.CurrentCamera.Car.tuning.acceleration.Value,game.Workspace.CurrentCamera.Car.tuning.brakespeed.Value,game.Workspace.CurrentCamera.Car.tuning.gear.MaxValue,game.Workspace.CurrentCamera.Car.tuning.grip.Value,game.Workspace.CurrentCamera.Car.tuning.idleaccel.Value,game.Workspace.CurrentCamera.Car.tuning.maxspeed.Value,game.Workspace.CurrentCamera.Car.tuning.steerspeed.Value,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.SoundId,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.Volume,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.idlepitch.Value,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.pitchinfluence.Value)
game.Workspace.SaveSlot1:FireServer(v,e,meshdat,blockdat,cydat,firedat,smokedat,pointlightdat,spotlightdat,wedgedat,game.Workspace.CurrentCamera.Car.tuning.acceleration.Value,game.Workspace.CurrentCamera.Car.tuning.brakespeed.Value,game.Workspace.CurrentCamera.Car.tuning.gear.MaxValue,game.Workspace.CurrentCamera.Car.tuning.grip.Value,game.Workspace.CurrentCamera.Car.tuning.idleaccel.Value,game.Workspace.CurrentCamera.Car.tuning.maxspeed.Value,game.Workspace.CurrentCamera.Car.tuning.steerspeed.Value,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.SoundId,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.Volume,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.idlepitch.Value,game.Workspace.CurrentCamera.Car.Seats.VehicleSeat.Sound.pitchinfluence.Value)
end
end)
server:
local datastore = game:GetService("DataStoreService")
local accelstore = datastore:GetDataStore("accelstore1")
local brakestore = datastore:GetDataStore("brakestore1")
local gearstore = datastore:GetDataStore("gearstore1")
local gripstore = datastore:GetDataStore("gripstore1")
local idlestore = datastore:GetDataStore("idlestore1")
local speedstore = datastore:GetDataStore("speedstore1")
local steerstore = datastore:GetDataStore("steerstore1")
local soundidstore = datastore:GetDataStore("soundidstore1")
local volumestore = datastore:GetDataStore("volumestore1")
local idlepitchstore = datastore:GetDataStore("idlepitchstore1")
local pitchrevstore = datastore:GetDataStore("pitchrevstore1")
local tabstore = datastore:GetDataStore("tabstore1")
local meshtabstore = datastore:GetDataStore("meshtabstore1")
local blokstore = datastore:GetDataStore("blokstore1")
local cystore = datastore:GetDataStore("cystore1")
local firstore = datastore:GetDataStore("firstore1")
local smokstore = datastore:GetDataStore("smokstore1")
local poinstore = datastore:GetDataStore("poinstore1")
local spotstore = datastore:GetDataStore("spotstore1")
local wedstore = datastore:GetDataStore("wedstore1")
script.Parent.OnServerEvent:Connect(function(plr,car,tab,meshtab,blok,cy,fir,smok,poin,spot,wed,accel,brake,gear,grip,idle,speed,steer,soundid,volume,idlepitch,pitchrev)
accelstore:SetAsync(plr.UserId,accel)
brakestore:SetAsync(plr.UserId,brake)
gearstore:SetAsync(plr.UserId,gear)
gripstore:SetAsync(plr.UserId,grip)
idlestore:SetAsync(plr.UserId,idle)
speedstore:SetAsync(plr.UserId,speed)
steerstore:SetAsync(plr.UserId,steer)
soundidstore:SetAsync(plr.UserId,soundid)
volumestore:SetAsync(plr.UserId,volume)
idlepitchstore:SetAsync(plr.UserId,idlepitch)
pitchrevstore:SetAsync(plr.UserId,pitchrev)
--tables
tabstore:SetAsync(plr.UserId,tab)
meshtabstore:SetAsync(plr.UserId,meshtab)
blokstore:SetAsync(plr.UserId,blok)
cystore:SetAsync(plr.UserId,cy)
firstore:SetAsync(plr.UserId,fir)
smokstore:SetAsync(plr.UserId,smok)
poinstore:SetAsync(plr.UserId,poin)
spotstore:SetAsync(plr.UserId,spot)
wedstore:SetAsync(plr.UserId,wed)
print("e")
end)
thanks

2 comments
I got concussed when I see this xD
Try tables