Hello, so, every time the outfit changes i need the idle animation to start, how ever the script i have made only does what it needs to do the first time, other times it is not changing the playing animation, even thought it prints that it is
local Number = script.Parent.Outfits.OutfitNumber
local RE = game:GetService("ReplicatedStorage"):WaitForChild("OpenWardrobe")
local closingRE = game:GetService("ReplicatedStorage"):WaitForChild("ApplyAvatar")
local sp = 1
local function Start()
local plr = script.Parent.Parent.Parent
local backpack = plr.Backpack.AvatarOutfits:GetChildren()
local avatar = game.Workspace.MainMenu.DummysFolder.Clothing:WaitForChild(plr.Name)
if Number.Value == "0" then
avatar.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(plr.UserId))
local description = game.Players:GetHumanoidDescriptionFromUserId(plr.UserId)
local idleId = description.IdleAnimation
print(idleId)
for i,x in pairs(script.Parent.Pages.Animations.ScrollingFrame:GetChildren()) do
if x:IsA("TextButton") then
if tostring(idleId) == tostring(x.Idle.Value) then
print("Found A Match "..x.Idle.Value)
local humanim = avatar.Humanoid:LoadAnimation(x.Animation)
humanim:Play()
humanim.Looped = true
humanim:AdjustSpeed(sp)
end
end
end
else
for i,v in pairs(backpack) do
if v.Name == Number.Value then
avatar.Humanoid:ApplyDescription(v.Humanoid:GetAppliedDescription())
local description = v.Humanoid:GetAppliedDescription()
local idleId = description.IdleAnimation
print(idleId)
for i,x in pairs(script.Parent.Pages.Animations.ScrollingFrame:GetChildren()) do
if x:IsA("TextButton") then
if tostring(idleId) == tostring(x.Idle.Value) then
print("Found A Match "..x.Idle.Value)
local humanim = avatar.Humanoid:LoadAnimation(x.Animation)
humanim:Play()
print("Playing Animation")
humanim.Looped = true
humanim:AdjustSpeed(sp)
end
end
end
end
end
for i,v in pairs(plr.Backpack.AvatarOutfits.DeleteButtons:FindFirstChild(Number.Value):GetChildren()) do
for i,c in pairs(v:GetChildren()) do
for i,x in pairs(script.Parent.Pages.Accessories:GetChildren()) do
if x:IsA("Frame") then
if c.Name == x.Name then
c.Parent = x.Wearing
end
end
end
end
end
end
end
Number:GetPropertyChangedSignal("Value"):Connect(Start)
RE.OnServerEvent:Connect(function(player)
if player.Name == script.Parent.Parent.Parent.Name then
Start()
RE:FireClient(player)
end
end)
if you have any questions please do ask