-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCode
80 lines (37 loc) · 1.56 KB
/
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--[[
Made by timothytheawesome (Scriptonix#6957)
Please give me credit if you use this in something.
--]]
repeat game:GetService'RunService'.RenderStepped:Wait() until game.Players.LocalPlayer
local bundleDetails = game:GetService'AssetService':GetBundleDetailsAsync(_G.BundleID)
local ch = game.Players.LocalPlayer.Character
local function switchAnimations(c)
local hum = c:WaitForChild'Humanoid'
wait(0.5)
if hum.RigType == Enum.HumanoidRigType.R15 then
local animations = c:WaitForChild'Animate':GetDescendants()
for _, v in pairs(animations) do
if v:IsA'Animation' then
for _, b in pairs(bundleDetails.Items) do
if string.lower(v.Name) == 'idle' then
local Id = 'rbxassetid://' .. b.Id
local animation = game:GetObjects(Id)[1]
local idle = v.Parent
idle:WaitForChild'Animation1'.AnimationId = animation:FindFirstDescendant('Animation1').AnimationId
idle:WaitForChild'Animation2'.AnimationId = animation:FindFirstDescendant('Animation2').AnimationId
elseif string.find(string.lower(b.Name),string.lower(v.Parent.Name)) then
local Id = 'rbxassetid://' .. b.Id
local animation = game:GetObjects(Id)[1]
v.AnimationId = animation:FindFirstChildWhichIsA('Animation',true).AnimationId
end
end
end
end
end
end
if ch then
switchAnimations(ch)
end
game.Players.LocalPlayer.CharacterAdded:Connect(function(c)
switchAnimations(c)
end)