ive tried any plugin i could find to convert keyframesequence to cframe animation module or smth but apparently my keyframesequence is so long that it exceeds the 200k characters that the script can be injected from the plugin so uh im kinda stuck. ive tried doing it myself and looping through them but with no success at all. this code kinda does work but apparently not as much as i would like it to (i really cannot explain it in a simple way so if u got time and wanna help me go in studio get an r15 char and run game:GetObjects("rbxassetid://18362161755")[2].Parent = workspace
in the studio cmdbar. the script down here was put anywhere where the client can run it and the reference objects have to be changed accordingly)
wait(3)
local ts = game:GetService("TweenService")
local rs = game:GetService("RunService")
local thing = workspace:WaitForChild("Freelancer") --r15
local ks = script:WaitForChild("freelancer") --keyframesequence
local kfs = ks:GetKeyframes()
table.sort(kfs, function(a, b) return a.Time < b.Time end)
local function getall(kf)
local tabl = {}
for i,v in pairs(kf:GetDescendants()) do
if v:IsA("Pose") then
table.insert(tabl,v.Name)
end
end
return tabl
end
local array = {}
for i,v in pairs(thing:GetChildren()) do
if v:IsA("BasePart") then
array[v.Name] = v.CFrame
end
end
local function animate()
for i=1,#kfs-1 do
local current = kfs[i]
local next = kfs[i+1]
local currentt = current.Time
local nextt = next.Time
local duration = nextt-currentt
local currentposes = getall(current)
local nextposes = getall(next)
local start = tick()
local connection
connection = rs.RenderStepped:Connect(function()
local t = tick()-start
local alpha = math.clamp(t/duration,0,1)
for i,v in ipairs(currentposes) do
local part = thing:FindFirstChild(v)
local actualpose = current:FindFirstChild(v,true)
if part then
local nextp = next:FindFirstChild(v,true)
local parentpose = nil
if actualpose.Parent:IsA("Pose") then
parentpose = actualpose.Parent
end
if nextp and parentpose then
part.CFrame = (parentpose.CFrame*array[v]*actualpose.CFrame):Lerp(parentpose.CFrame*array[v]*nextp.CFrame,alpha)
elseif nextp then
part.CFrame = (array[v]*actualpose.CFrame):Lerp(array[v]*nextp.CFrame,alpha)
end
end
end
if t >= duration then connection:Disconnect() end
end)
wait(duration)
end
end
wait(3)
animate()
sorry if my code is absolute garbage to look at but i never wouldve thought i would need help for this seemingly easy thing