-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTo-Anim
More file actions
38 lines (28 loc) · 1021 Bytes
/
To-Anim
File metadata and controls
38 lines (28 loc) · 1021 Bytes
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
return function(humanoid, Settings, FIXED_ANIMATION_ID)
local CurrentTrack
local function LoadTrack()
if CurrentTrack then
CurrentTrack:Stop(Settings["Fade Out"])
end
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://"..FIXED_ANIMATION_ID
local animator = humanoid:FindFirstChildOfClass("Animator")
or Instance.new("Animator", humanoid)
local newTrack = animator:LoadAnimation(anim)
newTrack.Priority = Enum.AnimationPriority.Action4
local weight = Settings["Weight"]
if weight == 0 then weight = 0.001 end
newTrack:Play(Settings["Fade In"], weight, Settings["Speed"])
CurrentTrack = newTrack
end
local function StopTrack()
if CurrentTrack then
CurrentTrack:Stop(Settings["Fade Out"])
CurrentTrack = nil
end
end
return {
LoadTrack = LoadTrack,
StopTrack = StopTrack
}
end