-- SISTEMA DE ANIMAÇÕES GLITTER (Loop de Animações) - SEM NOTIFICAÇÕES
local player = game.Players.LocalPlayer
-- Lista de animações: {ID, Tempo em segundos}
local GLITTER_ANIMS = {
{id = "rbxassetid://93607759371048", tempo = 0.42}, -- 1ª
{id = "rbxassetid://86806707642727", tempo = 0.54}, -- 2ª
{id = "rbxassetid://135373056067761", tempo = 0.24}, -- 3ª
{id = "rbxassetid://93206392584401", tempo = 0.63}, -- 4ª
{id = "rbxassetid://88353029240642", tempo = 0.52}, -- 5ª
{id = "rbxassetid://110990913678013", tempo = 0.34}, -- 6ª
{id = "rbxassetid://73061206570424", tempo = 0.10}, -- 7ª
}
local currentAnim = nil
local currentIndex = 1
local isPlaying = true
local animLoop = nil
-- Desativa animações padrão do Roblox
local function disableRobloxAnimate()
local character = player.Character
if character then
local animate = character:FindFirstChild("Animate")
if animate then
animate.Disabled = true
end
end
end
-- Para todas animações tocando
local function stopAllAnimations()
local character = player.Character
if character then
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
track:Stop()
end
end
end
if currentAnim then
currentAnim:Stop()
currentAnim = nil
end
end
-- Toca uma animação específica
local function playAnimById(animId, tempo)
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if not humanoid then return end
-- Para animação atual
if currentAnim then
currentAnim:Stop()
currentAnim = nil
end
-- Cria e toca nova animação
local anim = Instance.new("Animation")
anim.AnimationId = animId
currentAnim = humanoid:LoadAnimation(anim)
currentAnim:Play()
currentAnim:AdjustSpeed(1)
-- Agenda a próxima animação
if animLoop then
animLoop:Disconnect()
end
animLoop = game:GetService("RunService").Stepped:Connect(function()
wait(tempo)
if animLoop then
animLoop:Disconnect()
animLoop = nil
end
if isPlaying then
currentIndex = currentIndex + 1
if currentIndex > #GLITTER_ANIMS then
currentIndex = 1
end
local nextAnim = GLITTER_ANIMS[currentIndex]
playAnimById(nextAnim.id, nextAnim.tempo)
end
end)
end
-- Inicia o loop de animações
local function startGlitterLoop()
isPlaying = true
currentIndex = 1
local primeiraAnim = GLITTER_ANIMS[1]
playAnimById(primeiraAnim.id, primeiraAnim.tempo)
end
-- Para o loop de animações
local function stopGlitterLoop()
isPlaying = false
if animLoop then
animLoop:Disconnect()
animLoop = nil
end
stopAllAnimations()
end
-- Reinicia o loop (quando personagem renasce)
local function restartGlitterLoop()
stopGlitterLoop()
wait(0.1)
startGlitterLoop()
end
-- Quando o personagem aparecer
local function onCharacterAdded(character)
wait(0.5)
stopAllAnimations()
disableRobloxAnimate()
startGlitterLoop()
end
-- Conecta eventos
player.CharacterAdded:Connect(onCharacterAdded)
-- Inicia o sistema se já tem personagem
if player.Character then
onCharacterAdded(player.Character)
end
Comments
No comments yet
Be the first to share your thoughts!