@@ -9,6 +9,7 @@ local tool = script.Parent
9
9
local copyBox = UI
10
10
local actions = copyBox .Actions
11
11
local animationTrack = nil
12
+ local debound = false
12
13
13
14
-- Commands List.
14
15
local commandsList = require (script .Parent .Commands )
@@ -39,13 +40,19 @@ local uiEvents = coroutine.create(function()
39
40
if v :IsA (" TextButton" ) then
40
41
v .MouseButton1Click :Connect (function ()
41
42
if v .Name == " Enter" and tonumber (copyBox .Frame .Tempo .Text ) then
42
- v .Parent .Stop .TextTransparency = 0
43
- animationTrack = game .Players .LocalPlayer .Character .Humanoid .Animator :LoadAnimation (markTime )
44
- tempo .Value = tonumber (copyBox .Frame .Tempo .Text )
45
- animationTrack :Play ()
43
+ if debound == false then
44
+ debound = true
45
+ v .Parent .Stop .TextTransparency = 0
46
+ local numeral = tonumber (copyBox .Frame .Tempo .Text )/ 60
47
+ tempo .Value = numeral
48
+ end
46
49
end
47
50
if v .Name == " Stop" then
48
- animationTrack :Stop ()
51
+ debound = false
52
+ if animationTrack ~= nil then
53
+ animationTrack :Stop ()
54
+ animationTrack = nil
55
+ end
49
56
v .TextTransparency = 0.5
50
57
end
51
58
if v .Name == " LoadActions" then
68
75
69
76
tempo .Changed :Connect (function ()
70
77
-- Set the animation speed
71
- animationTrack :AdjustSpeed (tempo .Value / 60 )
78
+ if animationTrack ~= nil then
79
+ animationTrack :Stop ()
80
+ animationTrack = nil
81
+ end
82
+ animationTrack = game .Players .LocalPlayer .Character .Humanoid .Animator :LoadAnimation (markTime )
83
+ animationTrack :Play ()
84
+ animationTrack :AdjustSpeed (tempo .Value )
72
85
end )
73
86
74
87
tool .Equipped :Connect (function ()
88
+ debound = false
75
89
copyBox .Parent = game .Players .LocalPlayer .PlayerGui
76
90
isActive = true
77
91
print (" Activated" )
78
- -- coroutine.resume(uiEvents)
92
+ coroutine.resume (uiEvents )
79
93
end )
80
94
81
95
tool .Unequipped :Connect (function ()
82
96
print (" Deactivated" )
83
97
isActive = false
84
98
script .Parent .HangUp :FireServer ()
85
- animationTrack :Stop ()
99
+ debound = false
100
+ if animationTrack ~= nil then
101
+ animationTrack :Stop ()
102
+ animationTrack = nil
103
+ end
86
104
copyBox .Parent = workspace
87
- -- coroutine.yield(uiEvents)
105
+ coroutine.yield (uiEvents )
88
106
end )
0 commit comments