Skip to content

Commit 8ea2491

Browse files
unlag
1 parent abca14f commit 8ea2491

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

src/ServerStorage/DrumMajor/UIHandle.client.lua

+27-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local tool = script.Parent
99
local copyBox = UI
1010
local actions = copyBox.Actions
1111
local animationTrack = nil
12+
local debound = false
1213

1314
--Commands List.
1415
local commandsList = require(script.Parent.Commands)
@@ -39,13 +40,19 @@ local uiEvents = coroutine.create(function()
3940
if v:IsA("TextButton") then
4041
v.MouseButton1Click:Connect(function()
4142
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
4649
end
4750
if v.Name == "Stop" then
48-
animationTrack:Stop()
51+
debound = false
52+
if animationTrack ~= nil then
53+
animationTrack:Stop()
54+
animationTrack = nil
55+
end
4956
v.TextTransparency = 0.5
5057
end
5158
if v.Name == "LoadActions" then
@@ -68,21 +75,32 @@ end)
6875

6976
tempo.Changed:Connect(function()
7077
--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)
7285
end)
7386

7487
tool.Equipped:Connect(function()
88+
debound = false
7589
copyBox.Parent = game.Players.LocalPlayer.PlayerGui
7690
isActive = true
7791
print("Activated")
78-
--coroutine.resume(uiEvents)
92+
coroutine.resume(uiEvents)
7993
end)
8094

8195
tool.Unequipped:Connect(function()
8296
print("Deactivated")
8397
isActive = false
8498
script.Parent.HangUp:FireServer()
85-
animationTrack:Stop()
99+
debound = false
100+
if animationTrack ~= nil then
101+
animationTrack:Stop()
102+
animationTrack = nil
103+
end
86104
copyBox.Parent = workspace
87-
--coroutine.yield(uiEvents)
105+
coroutine.yield(uiEvents)
88106
end)

0 commit comments

Comments
 (0)