-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathClient.lua
3606 lines (2977 loc) · 124 KB
/
Client.lua
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--// FNF Client
script.Parent:WaitForChild("Config"):WaitForChild("ObjectCount")
repeat task.wait() until script.Parent.Config.ObjectCount.Value > 0 and #script.Parent:GetDescendants() >= script.Parent.Config.ObjectCount.Value
repeat task.wait() until script.Parent.Config.ServerSetup.Value == true
--// Variables
local player = game.Players.LocalPlayer
local ui = script.Parent
local config = ui.Config
local events = ui.Events
local stage = ui.Stage.Value
local userinput = events.UserInput
local side = ui.PlayerSide.Value
local main = ui.Game
local cameraPoints = stage.CameraPoints
local easeStyle = Enum.EasingStyle.Sine
if (player.Input.CamEaseStyle.Value ~= "Sine") then
local array = Enum.EasingStyle:GetEnumItems()
for i, v in pairs(array) do
if tostring(v) == ("Enum.EasingStyle."..player.Input.CamEaseStyle.Value) then
easeStyle = v
end
end
end
local fakeConductor = game.ReplicatedStorage.Modules.Conductor:Clone(); fakeConductor.Parent = ui
local Conductor = require(fakeConductor)
local Util = require(game.ReplicatedStorage.Modules.Util)
local TimingWindowStuff = require(game.ReplicatedStorage.Modules.TimingWindows)
local FlxVel = require(game.ReplicatedStorage.Modules.FlxVel)
local TS = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local RUNS = game:GetService('RunService')
local LOG = require(game.ReplicatedStorage.Modules.DebugLog)
local Sprite = require(game.ReplicatedStorage.Modules.Sprites.Sprite)
local Taiko = nil
local ratingLabels = {}
side = main:FindFirstChild(side)
--// Startup
local hitGraph = {}
stage.P1Board.G.Enabled = false
stage.P2Board.G.Enabled = false
stage.SongInfo.G.Enabled = false
stage.SongInfo.P1Icon.G.Enabled = false
stage.SongInfo.P2Icon.G.Enabled = false
stage.FlyingText.G.Enabled = false
config.TimePast.Value = -40
for _, cam in pairs(cameraPoints:GetChildren()) do cam.CFrame = cam.OriginalCFrame.Value end
local lCameraCF, rCameraCF, cCameraCF = cameraPoints.L.CFrame, cameraPoints.R.CFrame, cameraPoints.C.CFrame
for _, side in pairs({main.R, main.L}) do
local splashes = game.ReplicatedStorage.Misc.SplashContainer:Clone()
splashes.Parent = side
end
--// Post-Game Stuff
local _acc_ = 100
local iconData = {}
local songSelect = player.PlayerGui.GameUI:WaitForChild("SongSelect", 10)
local endscene = player.PlayerGui.GameUI:FindFirstChild("EndScene")
if endscene then endscene:Destroy() end
if not songSelect then warn("Infinite yield possible on song select menu. Please report this to a dev!"); songSelect = player.PlayerGui.GameUI:WaitForChild("SongSelect"); end
--// fc shit
songSelect.StatsContainer.FCs.Text = "<font color='rgb(90,220,255)'>FCs</font>: "..player.Input.Achievements.FCs.Value.." | <font color='rgb(255, 225, 80)'>PFCs</font>: "..player.Input.Achievements.PFCs.Value
local accuracy, misses, combo, highcombo = {}, 0, 0, 0 --// set stats
local actualAccuracy, marv, sick, good, ok, bad = 0,0,0,0,0,0
local function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
return math.floor(num * mult + 0.5) / mult
end
local hitGraphModule = require(ui.Modules.HitGraph)
local healthbarConfig = nil
local playbackRate = 1
local hasGimmickNotes = false
local nps = 0
local peakNps = 0
local npsData = {}
function updateData()
--print(data)
for i = 1, 2 do
if (stage.Config["P" .. i .. "Stats"].Value == "") then continue end
local data = game.HttpService:JSONDecode(stage.Config["P" .. i .. "Stats"].Value)
local label = main:FindFirstChild(i == 1 and "L" or "R").OpponentStats.Label
label.Text = "Accuracy: " .. data.accuracy .. "% | Combo: " .. data.combo .. " | Misses: " .. data.misses
stage.Config["P" .. i .. "Stats"].Value = ""
end
end
local function updateStats()
local info = ui.LowerContainer.Stats.Label
ui.LowerContainer.Bar.Visible = player.Input.HealthBar.Value
--if not player.Input.InfoBar.Value then return end
local d = 0
local data = ""
table.foreach(accuracy, function(_, v)
d += v
end)
local newAcc = 100
if d == 0 and #accuracy == 0 then
data = "Accuracy: 100%"
else
actualAccuracy = string.sub(tostring((d / #accuracy)), 1, 5)
data = "Accuracy: " .. actualAccuracy .. "%"
newAcc = actualAccuracy
end
data = data .. " | Combo: " ..combo .. " | Misses: " .. misses
info.Text = data
if player.Input.VerticalBar.Value then
info = ui.SideContainer.Accuracy
info.Text = string.gsub(data, " | ", "\n")
end
if combo > highcombo then highcombo = combo end
-- judgement counter !!!
local judgement = ui.SideContainer.Data
judgement.Text = "Marvelous: " .. marv .. "\nSick: " .. sick .. "\nGood: " .. good .. "\nOk: " .. ok .. "\nBad: " .. bad
-- extra data !!!
local extra = ui.SideContainer.Extra
extra.Text = "MA: "..round(marv / (sick == 0 and 1 or sick), 2) .. (sick == 0 and ":inf" or ":1").."\nPA: "..round(sick / (good == 0 and 1 or good), 2) .. (good == 0 and ":inf" or ":1")
extra.Text = extra.Text .. "\nMean: "..hitGraphModule.CalculateMean(hitGraph,player.Input.Offset.Value) .. "ms"
local npsDisplay = ui.SideContainer.NPS
npsDisplay.Text = "NPS: " .. nps .. "\nMax NPS: " .. peakNps
events.UpdateData:FireServer({
accuracy = newAcc,
combo = combo,
misses = misses,
bot = false
})
_acc_ = newAcc
if (healthbarConfig ~= nil and healthbarConfig.overrideStats) then
local shadowVal
local val
local p1, p2 = stage.Config.P1Points.Value, stage.Config.P2Points.Value
local score = stage.Config.Player1.Value == player and p1 or p2
local rating = "?"
if sick+good+ok+bad+misses == 0 then
rating = "MFC"
elseif good+ok+bad+misses == 0 then
rating = "PFC"
elseif ok+bad+misses == 0 then
rating = "GFC"
elseif misses == 0 then
rating = "FC"
elseif misses < 10 then
rating = "SDCB"
else
rating = "Clear"
end
if healthbarConfig.overrideStats.Value then
val = healthbarConfig.overrideStats.Value
val = string.gsub(val, "{misses}", misses)
val = string.gsub(val, "{combo}", combo)
val = string.gsub(val, "{score}", score)
val = string.gsub(val, "{rating}", rating)
val = string.gsub(val, "{accuracy}", newAcc .. "%%")
else
val = info.Text
end
if healthbarConfig.overrideStats.ShadowValue then
shadowVal = healthbarConfig.overrideStats.ShadowValue
shadowVal = string.gsub(shadowVal, "{misses}", misses)
shadowVal = string.gsub(shadowVal, "{combo}", combo)
shadowVal = string.gsub(shadowVal, "{accuracy}", newAcc .. "%%")
else
shadowVal = info.Text
end
if healthbarConfig.overrideStats.Separator then
val = string.gsub(val, "|", healthbarConfig.overrideStats.Separator)
shadowVal = val
end
if (healthbarConfig.overrideStats.ChildrenToUpdate) then
ui.SideContainer.Accuracy.Visible = false
info = ui.LowerContainer.Stats.Label
for i,v in pairs(healthbarConfig.overrideStats.ChildrenToUpdate) do
info = ui.LowerContainer.Stats[v]
if v:lower():match("shadow") then
info.Text = shadowVal
else
info.Text = val
end
end
else
if player.Input.VerticalBar.Value then
if healthbarConfig.overrideStats.Separator then
info.Text = string.gsub(val, " " ..healthbarConfig.overrideStats.Separator.." ", "\n")
else
info.Text = string.gsub(val, " | ", "\n")
end
else
info.Text = val
end
end
end
end
updateStats()
local function countdownPopup(waittime,number,config)
stage.MusicPart[number]:Play()
task.spawn(function()
if config == nil or config[number] == nil then return end
local img = ui.Countdown.Countdown:Clone()
img.Name = number
img.Image = config[number]
img.Visible = true
img.Parent = ui.Countdown
TS:Create(img,TweenInfo.new(waittime,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),{ImageTransparency = 1}):Play()
task.wait(waittime*1.2)
img:Destroy()
end)
end
local songLength = 0
local function tweeen(length,speed,songholder)
songLength = length
--print("CLIENT TIME: " .. songLength)
local waittime = 1 / speed
local modchartfile = (songholder:FindFirstChild("Modchart") and songholder.Modchart:IsA("ModuleScript")) and require(songholder.Modchart)
local music,vocals = ui.GameMusic.Music, ui.GameMusic.Vocals
if modchartfile and modchartfile.PreStart then
modchartfile.PreStart(ui,waittime)
end
local images = {}
if songholder:FindFirstChild("Countdown") and game.ReplicatedStorage.Countdowns:FindFirstChild(songholder.Countdown.Value) then
local conf = require(game.ReplicatedStorage.Countdowns:FindFirstChild(songholder.Countdown.Value).Config)
if conf.Audio ~= nil then
stage.MusicPart["3"].SoundId = conf.Audio["3"]
stage.MusicPart["2"].SoundId = conf.Audio["2"]
stage.MusicPart["1"].SoundId = conf.Audio["1"]
stage.MusicPart["Go"].SoundId = conf.Audio["Go"]
end
images = conf.Images
end
if songholder:FindFirstChild('ExtraCountdownTime') then task.wait(songholder.ExtraCountdownTime.Value) end
task.spawn(function()
if songholder:FindFirstChild("NoCountdown") then
task.wait(waittime*3)
stage.MusicPart["3"].Volume = 0
stage.MusicPart["Go"].Volume = 0
stage.MusicPart["3"]:Play()
stage.MusicPart["Go"]:Play()
task.wait(waittime)
music.Playing = true
vocals.Playing = true
else
countdownPopup(waittime,"3",images)
task.wait(waittime)
countdownPopup(waittime,"2",images)
task.wait(waittime)
countdownPopup(waittime,"1",images)
task.wait(waittime)
countdownPopup(waittime,"Go",images)
task.wait(waittime)
music.Playing = true
vocals.Playing = true
end
end)
for _, thing in pairs(stage.MusicPart:GetChildren()) do
if thing:IsA("Sound") and thing.Name ~= "SERVERmusic" and thing.Name ~= "SERVERvocals" then
thing.Volume = 0.5
end
end
config.TimePast.Value = -4 / speed
local lengthtween = TS:Create(config.TimePast,TweenInfo.new((length+(4/speed)), Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),
{Value=length})
lengthtween:Play()
--[[lengthtween.Completed:Connect(function()
print("CLIENT FINISHED: " .. config.TimePast.Value .. ", " .. tick())
end)]]
if songholder:FindFirstChild("Instrumental") then music.Volume = songholder.Instrumental.Volume.Value; end
if songholder:FindFirstChild("Sound") then vocals.Volume = songholder.Sound.Volume.Value; end
music.PitchEffect.Enabled = false
vocals.PitchEffect.Enabled = false
if songholder:FindFirstChild("Instrumental") then
music.SoundId = songholder.Instrumental.Value
music.PlaybackSpeed = songholder.Instrumental.PlaybackSpeed.Value
end
if songholder:FindFirstChild("Sound") then
vocals.SoundId = songholder.Sound.Value
vocals.PlaybackSpeed = songholder.Sound.PlaybackSpeed.Value
end
if playbackRate ~= 1 then
music.PlaybackSpeed = music.PlaybackSpeed * playbackRate
vocals.PlaybackSpeed = vocals.PlaybackSpeed * playbackRate
if (player.Input.DisablePitch.Value) then
music.PitchEffect.Enabled = true
vocals.PitchEffect.Enabled = true
music.PitchEffect.Octave = 1/playbackRate
vocals.PitchEffect.Octave = 1/playbackRate
end
end
music.TimePosition = 0
vocals.TimePosition = 0
end
events.Start.OnClientEvent:Connect(tweeen)
local skinType = game.ReplicatedStorage.Skins:FindFirstChild(player.Input.Skin.Value) or game.ReplicatedStorage.Skins.Default
local botSkinType = game.ReplicatedStorage.Skins:FindFirstChild(player.Input.BotSkin.Value) or game.ReplicatedStorage.Skins.Default
local skin = skinType.Notes.Value
local botSkin = botSkinType.Notes.Value
local blur = Instance.new("BlurEffect")
blur.Parent = game.Lighting
blur.Size = 0
--TS:Create(blur, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = 0}):Play()
--// modifier stuff
for _, modifierButton in pairs(songSelect.Modifiers:GetDescendants()) do
if modifierButton:IsA("ImageButton") then
modifierButton.ImageColor3 = Color3.fromRGB(136, 136, 136);local enabled=false
modifierButton.MouseButton1Click:Connect(function()
enabled=not enabled
TS:Create(modifierButton, TweenInfo.new(0.4), {ImageColor3 = enabled and Color3.fromRGB(255,255,255) or Color3.fromRGB(136, 136, 136)}):Play()
if modifierButton:FindFirstChild("misc") then
TS:Create(modifierButton.misc, TweenInfo.new(0.4), {ImageColor3 = enabled and Color3.fromRGB(255,255,255) or Color3.fromRGB(136, 136, 136)}):Play()
end
events.Modifiers:FireServer(modifierButton.Name)
end)
modifierButton.MouseEnter:Connect(function()
modifierButton.ZIndex = 2
local modifierLabel = script.ModifierLabel:Clone()
modifierLabel.Parent = modifierButton
modifierLabel.Text = " "..string.gsub(modifierButton.Info.Value, "|", "\n").." "
local ogSize = modifierLabel.Size
modifierLabel.Size = UDim2.new()
TS:Create(modifierLabel, TweenInfo.new(0.125), {Size = ogSize}):Play()
end)
modifierButton.MouseLeave:Connect(function()
while modifierButton:FindFirstChild("ModifierLabel") do
modifierButton.ZIndex = 1
local modifierLabel = modifierButton:FindFirstChild("ModifierLabel")
if modifierLabel then
TS:Create(modifierLabel, TweenInfo.new(0.125, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {Size = UDim2.new()}):Play()
task.wait(0.125)
modifierLabel:Destroy()
end
end
end)
end
end
function nowPlaying(ui,name)
local nowPlaying = game.ReplicatedStorage.Misc.NowPlaying:Clone()
nowPlaying.Parent = ui
nowPlaying.Position -= UDim2.fromScale(0.2,0)
nowPlaying.Color.BackgroundColor3 = Color3.new(1,0.75,0)
nowPlaying.BGColor.BackgroundColor3 = Util.MixColors(Color3.new(0.1,0.1,0.1),Color3.new(1,0.75,0))
nowPlaying.SongName.TextColor3 = Color3.new(1,0.75,0)
nowPlaying.SongName.Text = name
nowPlaying.ZIndex = 99999 -- just because highest lol...
game.TweenService:Create(nowPlaying, TweenInfo.new(1), {Position = nowPlaying.Position + UDim2.fromScale(0.2,0)}):Play()
task.wait(5.5)
local tween = game.TweenService:Create(nowPlaying, TweenInfo.new(1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {Position = nowPlaying.Position - UDim2.fromScale(0.2,0)});
tween:Play()
tween.Completed:Connect(function()
nowPlaying:Destroy()
end)
end
local multiplier = ui:WaitForChild("ModifierMultiplier")
songSelect.Modifiers.Multiplier.Text = "1x"; songSelect.Modifiers.Multiplier.TextColor3 = Color3.new(1,1,1)
multiplier.Changed:Connect(function()
local color;if multiplier.Value > 1 then color = Color3.fromRGB(255, 255, 0);elseif multiplier.Value < 1 then color = Color3.fromRGB(255, 64, 30);else color = Color3.fromRGB(255, 255, 255) end
Util.AnimateMultiplier(ui,songSelect.Modifiers.Multiplier,color)
songSelect.Modifiers.Multiplier.Text = multiplier.Value.."x"
end)
local lobbyMusic = ui.SelectionMusic:GetChildren()
local songselectionsong = lobbyMusic[math.random(1,#lobbyMusic)]
local songselectionsongVolume = songselectionsong.Volume
local songselectionsongSpeed = songselectionsong.PlaybackSpeed -- some songs have a different speed
songselectionsong.Volume = 0
songselectionsong:Play()
TS:Create(songselectionsong,TweenInfo.new(4,Enum.EasingStyle.Quint,Enum.EasingDirection.In),{Volume = songselectionsongVolume}):Play()
TS:Create(workspace.CurrentCamera, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {FieldOfView = 35}):Play()
TS:Create(blur, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = 25}):Play()
songSelect.Visible = true
if player.Input.StreamerMode.Value == true then
if not string.find(songselectionsong.Name,"FNF") then
songselectionsong.PlaybackSpeed -= 0.35
local a = Instance.new("EqualizerSoundEffect")
a.LowGain = 20
a.Parent = songselectionsong
end
else
songselectionsong.PlaybackSpeed = songselectionsongSpeed
if songselectionsong:FindFirstChildOfClass("EqualizerSoundEffect") then
songselectionsong:FindFirstChildOfClass("EqualizerSoundEffect"):Destroy()
end
end
task.delay(2.5,function()
nowPlaying(ui,songselectionsong.Name)
end)
songSelect.TimeLeft.Text = "Time Left: 15"
local c c = stage.Config.SelectTimeLeft.Changed:Connect(function()
if not ui.Parent then c:Disconnect() return end
songSelect.TimeLeft.Text = "Time Left: " .. stage.Config.SelectTimeLeft.Value
end)
--// load songs on client
stage.Events.LoadPlayer.OnClientInvoke = function(serverMusic, serverVocals)
--// basic preloading
ui.Loading.Visible = true
TS:Create(workspace.CurrentCamera, TweenInfo.new(.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {FieldOfView = 68}):Play()
game.ContentProvider:PreloadAsync({serverMusic, serverVocals})
--// reassurance check
local music,vocals = ui.GameMusic.Music, ui.GameMusic.Vocals
if serverMusic.SoundId ~= "" then
music.SoundId = serverMusic.SoundId
repeat task.wait() until music.TimeLength > 0
end
if serverVocals.SoundId ~= "" then
vocals.SoundId = serverVocals.SoundId
repeat task.wait() until vocals.TimeLength > 0
end
--// finish preloading
task.wait(.5)
ui.Loading.Visible = false
return true
end
--// Disable Stuffs
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = stage.CameraPoints.C.CFrame
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
game.StarterGui:SetCore("ResetButtonCallback", false)
local voteConnection; voteConnection = game.ReplicatedStorage.Events.PlayerSongVote.Event:Connect(function(name, difficulty, folder, rate)
if (not name) or (not difficulty) or (not folder) or (not rate) then return end
stage.Events.PlayerSongVote:FireServer(name, difficulty, folder, rate)
if stage.Config.SinglePlayerEnabled.Value then
playbackRate = rate
else
playbackRate = 1
end
config.PlaybackSpeed.Value = playbackRate
end)
for _, thing in pairs(player.PlayerGui.GameUI:GetChildren()) do
if not string.match(thing.Name, "SongSelect") then
thing.Visible = false
end
end
--// hide 2v2 song
songSelect:SetAttribute("2v2", nil)
for _, thing in pairs(songSelect.SongScroller:GetChildren()) do
if thing:GetAttribute("2V2") then thing.Visible = false end
end
for _, thing in pairs(songSelect.BasicallyNil:GetChildren()) do
if thing:GetAttribute("2V2") then thing.Visible = false end
end
songSelect.Background.Fill.OpponentSelect.Visible = true
songSelect.Background.Fill["Player 1Select"].Visible = false
songSelect.Background.Fill["Player 2Select"].Visible = false
songSelect.Background.Fill["Player 3Select"].Visible = false
songSelect.Background.Fill["Player 4Select"].Visible = false
--// Stuffs
repeat Util.wait() until stage.Config.Song.Value
local tttt = TS:Create(blur, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Size = 0}); tttt:Play(); tttt.Completed:Connect(function() blur:Destroy() end)
local tWeen = TS:Create(songselectionsong,TweenInfo.new(2,Enum.EasingStyle.Quint,Enum.EasingDirection.In),{Volume = 0}) tWeen:Play() tWeen.Completed:Connect(function() songselectionsong:Stop() end)
local song = stage.Config.Song.Value:IsA("StringValue") and stage.Config.Song.Value.Value or require(stage.Config.Song.Value)
local songholder = stage.Config.Song.Value:FindFirstAncestorOfClass("StringValue") or stage.Config.Song.Value
if songholder.Parent.Parent.Parent.Name == "Songs" and not songholder:FindFirstChild("Sound") then songholder = songholder.Parent end
local specialSong,sixKey,nineKey,sevenKey,fiveKey = Util.SpecialSongCheck(songholder)
songSelect.Visible = false; voteConnection:Disconnect()
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = stage.CameraPoints.C.CFrame
task.spawn(function()
stage.MusicPart["Go"].Played:Wait();
Util.NowPlaying(ui, songholder, player)
task.wait(1);
game.StarterGui:SetCore("ResetButtonCallback", true);
end)
--// Icons
local iconStuff = require(ui.Modules.Icons)
iconData = iconStuff.SetIcons(ui, songholder)
local succ, err = pcall(function() --// debugging
song = game.HttpService:JSONDecode(song).song
end)
if err then
song = game.HttpService:JSONDecode(require(game.ReplicatedStorage.Songs["/v/-tan"].Sage.Hard)).song
end
song.bpm = song.bpm
local bps, bpm = 60 / (song.bpm or 120), song.bpm
local sps = bps / 4
local function digital_format(n)
return string.format("%d:%02d", math.floor(n/60), n%60)
end
local credit = songholder.Credits.Value
local songName = (songholder.Parent.Parent.Parent.Name == "Songs" and songholder:IsA("ModuleScript")) and songholder.Parent.Name or songholder.Name
local difficulty = stage.Config.Song.Value.Name
local TimePosition = (stage.MusicPart.SERVERvocals.TimeLength - stage.MusicPart.SERVERvocals.TimePosition) / stage.MusicPart.SERVERvocals.PlaybackSpeed
ui.LowerContainer.Credit.Text = songName.." (" .. difficulty .. ")" .. " (" .. playbackRate .. "x)" .. "\n"..credit.."\n"..digital_format(math.ceil(TimePosition))
--// unique mobile buttons
if songholder:FindFirstChild("MobileButtons") then
ui.MobileButtons:Destroy()
songholder.MobileButtons:Clone().Parent = ui
end
--// Preload countdown
if songholder:FindFirstChild("Countdown") and game.ReplicatedStorage.Countdowns:FindFirstChild(songholder.Countdown.Value) then
local conf = require(game.ReplicatedStorage.Countdowns:FindFirstChild(songholder.Countdown.Value).Config)
local data = {}
if conf.Images ~= nil then
for i,v in pairs(conf.Images) do
table.insert(data,v)
end
end
if conf.Audio ~= nil then
for i,v in pairs(conf.Audio) do
table.insert(data,v)
end
end
game.ContentProvider:PreloadAsync(data)
end
--// modcharts and conductor
local modchartsEnabled = Util.ModchartCheck(ui, songholder, song)
local conductor = Conductor.Start(ui, songholder:FindFirstChild("Modchart"), bpm, modchartsEnabled, song, playbackRate)
--// Quick offsetting
local Functions = require(ui.Modules.Functions)
Functions.keyCheck(songholder, nineKey, sixKey, sevenKey, fiveKey)
local offset = songholder.Offset.Value + (player.Input.Offset.Value or 0)
local SongNoteConvert; if songholder:FindFirstChild("notetypeconvert") then SongNoteConvert = require(songholder.notetypeconvert); end
Functions.stuffCheck(songholder)
local convert = songholder:FindFirstChild("notetypeconvert") and SongNoteConvert.notetypeconvert or Functions.notetypeconvert
if SongNoteConvert and SongNoteConvert.newKeys then SongNoteConvert.newKeys(ui); specialSong = true end
--// check to see if a players settings have changed
local otherPlayer
if not stage.Config.SinglePlayerEnabled.Value then
if stage.Config.Player1.Value == player then
otherPlayer = stage.Config.Player2.Value
else
otherPlayer = stage.Config.Player1.Value
end
end
local otherSkinType = otherPlayer and game.ReplicatedStorage.Skins:FindFirstChild(otherPlayer.Input.Skin.Value) or game.ReplicatedStorage.Skins.Default
local otherSkin = otherSkinType.Notes.Value
main.L.Arrows.IncomingNotes.DescendantAdded:Connect(function(arrow)
if not (main.Rotation >= 90) then return end
if songholder:FindFirstChild("NoSettings") then return end
if arrow:IsA("Frame") and arrow:FindFirstChild("Frame") then
arrow.Rotation = 180
arrow.Frame.Rotation = 180
arrow.Frame.Arrow.Rotation = 180
end
end)
main.R.Arrows.IncomingNotes.DescendantAdded:Connect(function(arrow)
if not (main.Rotation >= 90) then return end
if songholder:FindFirstChild("NoSettings") then return end
if arrow:IsA("Frame") and arrow:FindFirstChild("Frame") then
arrow.Rotation = 180
arrow.Frame.Rotation = 180
arrow.Frame.Arrow.Rotation = 180
end
end)
local AnimatedReceptors = {
L = {},
R = {}
}
function ChangeUI(style)
if style ~= nil then
--print("UI Style change to " .. style)
local UI = game.ReplicatedStorage.UIStyles[style]
healthbarConfig = require(UI.Config)
local newStats
local newBar
-- remove old UI
ui.LowerContainer.Bar:Destroy()
-- replace new UI
if player.Input.UseOldHealthbar.Value == true and style == "Default" then
newBar = UI.BarOLD:Clone()
newBar.Parent = ui.LowerContainer
else
newBar = UI.Bar:Clone()
newBar.Parent = ui.LowerContainer
end
-- set custom colors
if healthbarConfig.HealthBarColors then
newBar.Background.BackgroundColor3 = healthbarConfig.HealthBarColors.Green or Color3.fromRGB(114, 255, 63)
newBar.Background.Fill.BackgroundColor3 = healthbarConfig.HealthBarColors.Red or Color3.fromRGB(255, 0, 0)
end
-- toggle icons
if healthbarConfig.ShowIcons then
newBar.Player1.Sprite.Visible = healthbarConfig.ShowIcons.Dad
newBar.Player2.Sprite.Visible = healthbarConfig.ShowIcons.BF
end
if UI:FindFirstChild("Stats") then
ui.LowerContainer.Stats:Destroy()
-- replace new stats
newStats = UI.Stats:Clone()
newStats.Parent = ui.LowerContainer
if healthbarConfig.font then
newStats.Label.Font = healthbarConfig.font
ui.Stats.Label.Font = healthbarConfig.font
ui.SideContainer.NPS.Font = healthbarConfig.font
ui.SideContainer.Data.Font = healthbarConfig.font
ui.SideContainer.Extra.Font = healthbarConfig.font
ui.SideContainer.Accuracy.Font = healthbarConfig.font
ui.LowerContainer.Credit.Font = healthbarConfig.font
end
end
if healthbarConfig.isPixel then
ui.LowerContainer.PointsA.Font = Enum.Font.Arcade
ui.LowerContainer.PointsB.Font = Enum.Font.Arcade
else
ui.LowerContainer.PointsA.Font = Enum.Font.GothamBold
ui.LowerContainer.PointsB.Font = Enum.Font.GothamBold
end
if healthbarConfig.overrideStats then
if healthbarConfig.overrideStats.Credits then
local val = healthbarConfig.overrideStats.Credits
val = string.gsub(val, "{song}", songName)
val = string.gsub(val, "{rate}", playbackRate)
val = string.gsub(val, "{credits}", credit)
val = string.gsub(val, "{difficulty}", difficulty)
val = string.gsub(val, "{capdifficulty}", difficulty:upper())
if healthbarConfig.overrideStats.Timer then
val = string.gsub(val, "{timer}", healthbarConfig.overrideStats.Timer)
end
ui.LowerContainer.Credit.Text = val
elseif healthbarConfig.overrideStats.Timer then
ui.LowerContainer.Credit.Text = songName.." (" .. difficulty .. ")" .. " (" .. playbackRate .. "x)" .. "\n"..credit.."\n"..healthbarConfig.overrideStats.Timer
end
end
else
--print("UI Style change to Default")
local UI = game.ReplicatedStorage.UIStyles["Default"]
healthbarConfig = require(UI.Config)
-- remove old UI
ui.LowerContainer.Bar:Destroy()
ui.LowerContainer.Stats:Destroy()
-- replace new UI
local newBar = UI.Bar:Clone()
newBar.Parent = ui.LowerContainer
local newStats = UI.Stats:Clone()
newStats.Parent = ui.LowerContainer
ui.LowerContainer.PointsA.Font = Enum.Font.GothamBold
ui.LowerContainer.PointsB.Font = Enum.Font.GothamBold
end
updateStats()
local iconStuff = require(ui.Modules.Icons)
iconData = iconStuff.SetIcons(ui, songholder)
updateUI()
end
local originalTextSize = {}
function updateUI(variable)
local oppositeside = main:FindFirstChild(side.Name == "L" and "R" or "L")
if player.Input.VerticalBar.Value then
ui.LowerContainer.Stats.Visible = false
ui.SideContainer.Accuracy.Visible = true
end
if player.Input.InfoBar.Value == false then
ui.LowerContainer.Stats.Visible = false
ui.SideContainer.Accuracy.Visible = false
end
ui.Stats.Visible = player.Input.ShowDebug.Value
ui.SideContainer.Data.Visible = player.Input.JudgementCounter.Value
ui.SideContainer.Extra.Visible = player.Input.ExtraData.Value
ui.SideContainer.NPS.Visible = player.Input.NPSData.Value
if player.Input.ShowOpponentStats.Value then
if player.Input.Middlescroll.Value then
oppositeside.OpponentStats.Visible = player.Input.ShowOtherMS.Value
else
oppositeside.OpponentStats.Visible = player.Input.ShowOpponentStats.Value
end
main.L.OpponentStats.Label.Rotation = 180
main.R.OpponentStats.Label.Rotation = 180
end
if player.Input.HideScore.Value then
ui.LowerContainer.PointsA.Visible = false
ui.LowerContainer.PointsB.Visible = false
end
if player.Input.HideCredits.Value then
ui.LowerContainer.Credit.Visible = false
end
for _, note in pairs(main.Templates:GetChildren()) do
note.Frame.Bar.End.ImageTransparency = player.Input.BarOpacity.Value
note.Frame.Bar.ImageLabel.ImageTransparency = player.Input.BarOpacity.Value
end
--[[if songholder:FindFirstChild("Taiko") then
Taiko = require(game.ReplicatedStorage.Modules.Taiko)
Taiko.Init(ui)]]
if not songholder:FindFirstChild("NoSettings") then
if healthbarConfig ~= nil and healthbarConfig.overrideStats and healthbarConfig.overrideStats.Position and healthbarConfig.overrideStats.Position.Upscroll then
ui.LowerContainer.Stats.Position = healthbarConfig.overrideStats.Position.Upscroll
end
if healthbarConfig ~= nil and healthbarConfig.overrideStats and healthbarConfig.overrideStats.BarPosition and healthbarConfig.overrideStats.BarPosition.Upscroll then
ui.LowerContainer.Bar.Position = healthbarConfig.overrideStats.BarPosition.Upscroll
end
if healthbarConfig ~= nil and healthbarConfig.overrideStats and healthbarConfig.overrideStats.IconPosition then
ui.LowerContainer.Bar.Player1.Sprite.Position = healthbarConfig.overrideStats.IconPosition.P1.Upscroll
ui.LowerContainer.Bar.Player2.Sprite.Rotation = healthbarConfig.overrideStats.IconPosition.P2.Upscroll
end
if player.Input.VerticalBar.Value then
if healthbarConfig ~= nil and not healthbarConfig.OverrideVertical then
local size = ui.LowerContainer.Bar.Size
ui.LowerContainer.Bar.Position = UDim2.new(1.1, 0,-4, 0)
ui.LowerContainer.Bar.Size = UDim2.new(size.X.Scale * 0.8, size.X.Offset, size.Y.Scale, size.Y.Offset)
ui.LowerContainer.Bar.Rotation = 90
ui.LowerContainer.Bar.Player1.Sprite.Rotation = -90
ui.LowerContainer.Bar.Player2.Sprite.Rotation = -90
end
end
if player.Input.Downscroll.Value then
local statsPos = UDim2.new(0.5, 0,8.9, 0)
if healthbarConfig ~= nil and healthbarConfig.overrideStats and healthbarConfig.overrideStats.Position and healthbarConfig.overrideStats.Position.Downscroll then
statsPos = healthbarConfig.overrideStats.Position.Downscroll
end
if healthbarConfig ~= nil and healthbarConfig.overrideStats and healthbarConfig.overrideStats.BarPosition and healthbarConfig.overrideStats.BarPosition.Downscroll then
ui.LowerContainer.Bar.Position = healthbarConfig.overrideStats.BarPosition.Downscroll
end
if healthbarConfig ~= nil and healthbarConfig.overrideStats and healthbarConfig.overrideStats.IconPosition then
ui.LowerContainer.Bar.Player1.Sprite.Position = healthbarConfig.overrideStats.IconPosition.P1.Downscroll
ui.LowerContainer.Bar.Player2.Sprite.Rotation = healthbarConfig.overrideStats.IconPosition.P2.Downscroll
end
main.Rotation = 180
main.Position = UDim2.new(0.5,0,0.05,0)
ui.LowerContainer.AnchorPoint = Vector2.new(0.5,0)
ui.LowerContainer.Position = UDim2.new(0.5,0,0.1,0)
ui.LowerContainer.Stats.Position = statsPos
ui.LowerContainer.Credit.Position = UDim2.new(-0.167, 0,-0.6, 0)
main.R.Position = UDim2.new(0,0,0,0)
main.R.AnchorPoint = Vector2.new(0.1,0)
main.L.Position = UDim2.new(1,0,0,0)
main.L.AnchorPoint = Vector2.new(0.9,0)
main.L.Arrows.Rotation = 180
main.R.Arrows.Rotation = 180
main.L.SplashContainer.Rotation = 180
main.R.SplashContainer.Rotation = 180
main.L.OpponentStats.Label.Rotation = 0
main.R.OpponentStats.Label.Rotation = 0
if player.Input.VerticalBar.Value then
if healthbarConfig ~= nil and not healthbarConfig.OverrideVertical then
local size = ui.LowerContainer.Bar.Size
ui.LowerContainer.Bar.Position = UDim2.new(1.1, 0,4, 0)
ui.LowerContainer.Bar.Rotation = 90
ui.LowerContainer.Bar.Player1.Sprite.Rotation = -90
ui.LowerContainer.Bar.Player2.Sprite.Rotation = -90
end
end
if not specialSong then
main.L.Arrows.IncomingNotes.Left.Rotation = 180
main.L.Arrows.IncomingNotes.Down.Rotation = 180
main.L.Arrows.IncomingNotes.Up.Rotation = 180
main.L.Arrows.IncomingNotes.Right.Rotation = 180
main.R.Arrows.IncomingNotes.Left.Rotation = 180
main.R.Arrows.IncomingNotes.Down.Rotation = 180
main.R.Arrows.IncomingNotes.Up.Rotation = 180
main.R.Arrows.IncomingNotes.Right.Rotation = 180
else
main.L.Arrows.IncomingNotes.Rotation = 180
main.R.Arrows.IncomingNotes.Rotation = 180
end
main.L.Glow.Rotation = 180
main.R.Glow.Rotation = 180
elseif variable == "Downscroll" then
main.Rotation = 0
main.Position = UDim2.new(0.5,0,0.125,0)
ui.LowerContainer.Position = UDim2.new(0.5,0,0.9,0)
ui.LowerContainer.Stats.Position = UDim2.new(0.5, 0,1, 0)
ui.LowerContainer.AnchorPoint = Vector2.new(0.5,1)
ui.LowerContainer.Credit.Position = UDim2.new(-0.167, 0,-8.582, 0)
main.L.Position = UDim2.new(0,0,0,0)
main.L.AnchorPoint = Vector2.new(0.1,0)
main.R.Position = UDim2.new(1,0,0,0)
main.R.AnchorPoint = Vector2.new(0.9,0)
if player.Input.VerticalBar.Value then
if healthbarConfig ~= nil and not healthbarConfig.OverrideVertical then
local size = ui.LowerContainer.Bar.Size
ui.LowerContainer.Bar.Position = UDim2.new(1.1, 0,-4, 0)
ui.LowerContainer.Bar.Rotation = 90
ui.LowerContainer.Bar.Player1.Sprite.Rotation = -90
ui.LowerContainer.Bar.Player2.Sprite.Rotation = -90
end
end
main.L.Arrows.Rotation = 0
main.R.Arrows.Rotation = 0
if not specialSong then
main.L.Arrows.IncomingNotes.Left.Rotation = 0
main.L.Arrows.IncomingNotes.Down.Rotation = 0
main.L.Arrows.IncomingNotes.Up.Rotation = 0
main.L.Arrows.IncomingNotes.Right.Rotation = 0
main.R.Arrows.IncomingNotes.Left.Rotation = 0
main.R.Arrows.IncomingNotes.Down.Rotation = 0
main.R.Arrows.IncomingNotes.Up.Rotation = 0
main.R.Arrows.IncomingNotes.Right.Rotation = 0
else
main.L.Arrows.IncomingNotes.Rotation = 0
main.R.Arrows.IncomingNotes.Rotation = 0
end
main.L.Glow.Rotation = 0
main.R.Glow.Rotation = 0
end
if player.Input.Middlescroll.Value then
oppositeside.Visible = player.Input.ShowOtherMS.Value
side.Position = UDim2.new(0.5,0,0.5,0)
side.AnchorPoint = Vector2.new(0.5,0.5)
if player.Input.ShowOtherMS.Value then
oppositeside.OpponentStats.Size = UDim2.new(2,0,0.05,0)
oppositeside.OpponentStats.Position = UDim2.new(0.5,0,-0.08,0)
oppositeside.AnchorPoint = Vector2.new(0.1, 0)
oppositeside.Size = UDim2.new(0.15,0, 0.3,0)
oppositeside.Position = oppositeside.Name == "R" and UDim2.new(0.88,0, 0.5,0) or UDim2.new(0,0, 0.5,0)
if player.Input.Downscroll.Value then oppositeside.Position = oppositeside.Name == "L" and UDim2.new(0.88,0, 0.5,0) or UDim2.new(0,0, 0.5,0) end
end
elseif variable == "Middlescroll" then
oppositeside.Visible = true
main.L.Position = UDim2.new(0,0, 0,0)
main.L.Size = UDim2.new(0.5,0, 1,0)
main.L.AnchorPoint = Vector2.new(0.1, 0)
main.R.AnchorPoint = Vector2.new(0.9, 0)
main.R.Size = UDim2.new(0.5,0, 1,0)
main.R.Position = UDim2.new(1,0, 0,0)
if player.Input.Downscroll.Value then
main.R.Position = UDim2.new(0,0,0,0)
main.R.AnchorPoint = Vector2.new(0.1,0)
main.L.Position = UDim2.new(1,0,0,0)
main.L.AnchorPoint = Vector2.new(0.9,0)
end
end
end