code:
local phase = workspace.Minigame1.Phase
phase.Value = 1
local debounce = false
local tapedebounce = false
local songs = workspace.Minigame1.Songs
game:GetService("ContentProvider"):PreloadAsync(songs:GetChildren())
currentsongcounter = workspace.Minigame1.CurrentSongCounter.Value
local currentsong = songs.Song1
local anim3
local songstable = {
[1] = function()
songs.Song1:Play()
currentsongcounter += 1
currentsong = songs.Song1
end,
[2] = function ()
songs.Song2:Play()
currentsongcounter += 1
currentsong = songs.Song2
end,
[3] = function ()
songs.Song3:Play()
currentsongcounter += 1
currentsong = songs.Song3
end,
[4] = function ()
songs.Song4:Play()
currentsongcounter += 1
currentsong = songs.Song4
end,
[5] = function ()
songs.Song5:Play()
currentsongcounter += 1
currentsong = songs.Song5
end,
[6] = function ()
songs.Song6:Play()
currentsongcounter += 1
currentsong = songs.Song6
end,
[7] = function ()
songs.Song7:Play()
currentsongcounter += 1
currentsong = songs.Song7
end,
[8] = function ()
songs.Song8:Play()
currentsongcounter += 1
currentsong = songs.Song8
end,
[9] = function ()
songs.Song9:Play()
currentsongcounter += 1
currentsong = songs.Song9
end,
[10] = function ()
songs.Song10:Play()
currentsongcounter += 1
currentsong = songs.Song10
end,
}
local animations = {
[1] = function()
script.Parent.Animations.AnimationId = "rbxassetid://13142014107"
end,
[2] = function()
script.Parent.Animations.AnimationId = "rbxassetid://130321654403"
anim.Stopped:Connect(function()
script.Parent.Animations.AnimationId = "rbxassetid://13144460557"
end)
end
}
local function updateanimation()
warn("Updating animation")
if phase.Value <= 6 then
animations[phase.Value]()
anim = script.Parent.Humanoid:LoadAnimation(script.Parent.Animations)
anim:Stop()
anim:Play()
warn("Updated animation.")
end
end
updateanimation()
phase:GetPropertyChangedSignal("Value"):Connect(updateanimation)
local tape = workspace.Minigame1.TapePlayer.Button
tape.ClickDetector.MouseClick:Connect(function()
if not tapedebounce then
task.spawn(function()
tapedebounce = true
print(currentsong)
task .wait(math.random(1, currentsong.TimeLength))
if math.random(1,10) == 1 and not debounce then
print("moved during the song")
phase.Value += 1
debounce = true
task.wait(15)
debounce = false
end
end)
tape.TapePlay:Play()
print(tapedebounce)
tape.Color = Color3.fromRGB(255)
tape.Parent.Screen.Color = Color3.fromRGB(255, 255, 255)
songstable[currentsongcounter]()
currentsong.Ended:Connect(function()
tape.TapeStop:Play()
tape.Color = Color3.fromRGB(0,255)
tape.Parent.Screen.Color = Color3.fromRGB()
tapedebounce = false
if not debounce and math.random(1,2) == 1 then
print("moved after the song")
phase.Value += 1
debounce = true
task.delay(5, function()
debounce = false
end)
end
end)
end
end)
end)
pretty messy.
it’s painnn
also the 2nd time it updates the phase it just errors
aka this line
animations[phase.Value]()
i have no clue what is happening