Hello so I want to save the serialized cframes in server inside a folder and an instance value in a player so i have a client script that fires an event which creates that folder and instance value in the server and providing it with the value i passed as a parameter
But it gives me this error which makes no sense
client script:
game.ReplicatedStorage.PlayerWon.OnClientInvoke = function()
-- player has won
if not StartTime and #RunRecord <= 0 then
return
end
local CurrentTime = tick() - StartTime
local BestRuns = Player.BestRuns
local BestRunRecords = Player.BestRunRecords
local BestRunForCurrentObby = BestRuns:FindFirstChild(GetRecordPath())
local BestRunRecordForCurrentObby = BestRunRecords:FindFirstChild(GetRecordPath())
local SerializedRecording = ClientFunctions.SerializeCFrames(RunRecord)
if not SerializedRecording then
return
end
if BestRunForCurrentObby then
if CurrentTime < BestRunForCurrentObby.Value then
game.ReplicatedStorage.ChangePlayerValue:FireServer(BestRunForCurrentObby,CurrentTime)
game.ReplicatedStorage.ChangePlayerValue:FireServer(BestRunRecordForCurrentObby,SerializedRecording)
end
else
game.ReplicatedStorage.CreateInstance:FireServer("NumberValue",GetRecordPath(),CurrentTime,BestRuns)
game.ReplicatedStorage.CreateInstance:FireServer("StringValue",GetRecordPath(),SerializedRecording,BestRunRecords)
end
end
ServerScript (which has the error on the 4th line)
game.ReplicatedStorage.CreateInstance.OnServerEvent:Connect(function(Player,Type,Name,v,Parent)
local Inst = Instance.new(Type)
Inst.Name = Name
Inst.Value = v
Inst.Parent = Parent
end)
Serialize CFrame function which is inside of a module script named ClientScripts
SerializeCFrames = function(Recording)
local Serialization = ""
for _,Frame in pairs(Recording) do
Serialization ..= tostring(Frame) .. "_"
end
return Serialization:sub(1,#Serialization - 1)
end
Actually my post won’t work for you, it will interfere with your NumberValue, so disregard my post. Can you do print(typeof(SerializedRecording)) and print(SerializedRecording) in your code? Just post what they send here.
How long is the string? iirc, if the string being set a property is too long, that error is outputted (It’s very strange). If the string isn’t long enough to hit the limit, I’m not sure what the issue could be.
True, esp because position values can be very large because of decimals. You may want to cap the positions to a certain decimal point if you get what I mean.