Hello and the problem is when i animate this mesh rig (connected to r6 rig)
and use it in my game it pauses a little bit for random times.
animation original:
in game:
this is the script:
local Folder = game.ReplicatedStorage.Kagune.KenKaneki.S1
local event = Folder.Summon
local TweenService = game:GetService("TweenService")
local PartStorage = Folder.KaguneParts
event.OnServerEvent:Connect(function(player, Summon)
local character = player.Character
local hum = character.Humanoid
local torso = character.Torso
print("ServerScript:Summon")
print("Summon Value: ", Summon) -- Debugging: Print the value of Summon
local function removeAllDescendantsNamedB(parent)
for _, child in pairs(parent:GetDescendants()) do
if child.Name == "B" then
child:Destroy()
end
end
end
if Summon then
local gui = game.ReplicatedStorage.GuiSystem.MOVESETGUI:Clone()
gui.Parent = player.PlayerGui
local kagunemodel = game.ReplicatedStorage.Kagune.KenKaneki.S1.KaguneParts.KenS1Model:Clone()
kagunemodel.Parent = character
kagunemodel["Tent Seg0W"].Part0 = torso
kagunemodel["Tent Seg1W"].Part0 = torso
kagunemodel["Tent Seg2W"].Part0 = torso
local SpawnSound = script.Spawn:Clone()
SpawnSound.Parent = character
SpawnSound:Play()
game.Debris:AddItem(SpawnSound,1.5)
-- Summon Animation
local animator = character.Humanoid:FindFirstChildOfClass("Animator")
local initialAnim = script.Summon
local initialTrack = animator:LoadAnimation(initialAnim)
initialTrack.Priority = Enum.AnimationPriority.Action4
initialTrack.Looped = false
character:SetAttribute("Attacking",true)
-- when animation stops
initialTrack.Stopped:Connect(function()
character:SetAttribute("Attacking",false)
end)
local initialAnim1 = script.Idle
local initialTrack1 = animator:LoadAnimation(initialAnim1)
initialTrack1.Priority = Enum.AnimationPriority.Idle
initialTrack1.Looped = true
initialTrack1:Play()
-- Function to remove all descendants named "B"
-- Main part of your script
elseif not Summon then
print("Unsummon")
local gui = player.PlayerGui:FindFirstChild("MOVESETGUI")
if gui then
gui:Destroy()
end
local kagunemodel = character:FindFirstChild("KenS1Model")
local kagunehum = kagunemodel.Humanoid
character:SetAttribute("Attacking",true)
local animator = kagunehum:FindFirstChildOfClass("Animator") or Instance.new("Animator", kagunehum)
local initialAnim = script.UnSummon
local initialTrack = animator:LoadAnimation(initialAnim)
initialTrack.Priority = Enum.AnimationPriority.Action4
initialTrack.Looped = false
local goal = {}
goal.Transparency = 1
local tweenInfo = TweenInfo.new(0.5,Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = TweenService:Create(kagunemodel.kagunever2norig, tweenInfo, goal)
initialTrack:Play()
wait(0.5)
tween:Play()
wait(0.8)
kagunemodel:Destroy()
character:SetAttribute("Attacking",false)
end
end)
i would really be thankful if someone replied to me!