-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScript
More file actions
736 lines (630 loc) · 27.1 KB
/
Script
File metadata and controls
736 lines (630 loc) · 27.1 KB
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
-- Clean up old instance if re-executed
if getgenv().IY_Style_Freecam then
getgenv().IY_Style_Freecam:Disconnect()
getgenv().IY_Style_Freecam = nil
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
local oldUi = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):FindFirstChild("FreecamUI")
if oldUi then oldUi:Destroy() end
pcall(function()
local PlayerModule = require(game:GetService("Players").LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
PlayerModule:GetControls():Enable()
end)
end
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
-- Configuration Keys
local TOGGLE_KEY = Enum.KeyCode.F4
local MENU_KEY = Enum.KeyCode.K
local SPEED_DOWN_KEY = Enum.KeyCode.LeftBracket
local SPEED_UP_KEY = Enum.KeyCode.RightBracket
-- State variables
local active = false
local menuVisible = false
local showingInstructions = false
local targets = {}
local camCFrame = camera.CFrame
local rotationX, rotationY = 0, 0
local savedDefaultFov = camera.FieldOfView
local orbitDistance = 20
-- Tuned Parameters
local flySpeed = 1.0
local minSpeed = 0.1
local maxSpeed = 4.0
local speedStep = 0.15
local shiftMultiplier = 2.2
local sensitivity = 0.4
local targetFov = 70
local smoothingWeight = 15
local movement = {W = 0, A = 0, S = 0, D = 0, E = 0, Q = 0}
-- Setup UI Environment
local playerGui = player:WaitForChild("PlayerGui", 10)
if not playerGui then return end
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "FreecamUI"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.Parent = playerGui
-- Canvas Group for Smooth Fading Transitions
local MainCanvas = Instance.new("CanvasGroup")
MainCanvas.Name = "MainCanvas"
MainCanvas.Size = UDim2.new(0, 250, 0, 360)
MainCanvas.Position = UDim2.new(0.05, 0, 0.2, 0)
MainCanvas.BackgroundTransparency = 1
MainCanvas.GroupTransparency = 1
MainCanvas.Visible = false
MainCanvas.Active = true
MainCanvas.Draggable = true
MainCanvas.Parent = ScreenGui
-- Base Frame inside Canvas
local MainPanel = Instance.new("Frame")
MainPanel.Name = "MainPanel"
MainPanel.Size = UDim2.new(1, 0, 1, 0)
MainPanel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
MainPanel.BorderSizePixel = 0
MainPanel.Parent = MainCanvas
local function applyDarkGradient(instance)
local gradient = Instance.new("UIGradient")
gradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(12, 14, 23)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(4, 4, 6))
})
gradient.Rotation = 45
gradient.Parent = instance
end
local function applyBorderGradient(instance)
local gradient = Instance.new("UIGradient")
gradient.Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.fromRGB(35, 45, 75)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(12, 16, 28))
})
gradient.Rotation = 45
gradient.Parent = instance
end
applyDarkGradient(MainPanel)
local MainCorner = Instance.new("UICorner")
MainCorner.CornerRadius = UDim.new(0, 8)
MainCorner.Parent = MainPanel
local MainStroke = Instance.new("UIStroke")
MainStroke.Thickness = 1.5
MainStroke.Color = Color3.fromRGB(255, 255, 255)
MainStroke.Parent = MainPanel
applyBorderGradient(MainStroke)
-- Header Title
local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, -70, 0, 35)
Title.Position = UDim2.new(0, 14, 0, 0)
Title.BackgroundTransparency = 1
Title.Text = "Cinematic Freecam Studio"
Title.TextColor3 = Color3.fromRGB(230, 235, 255)
Title.Font = Enum.Font.GothamBold
Title.TextSize = 13
Title.TextXAlignment = Enum.TextXAlignment.Left
Title.Parent = MainPanel
-- Container Windows (Main Controls Frame vs Instructions Frame)
local ControlsFrame = Instance.new("Frame")
ControlsFrame.Name = "ControlsFrame"
ControlsFrame.Size = UDim2.new(1, 0, 1, -35)
ControlsFrame.Position = UDim2.new(0, 0, 0, 35)
ControlsFrame.BackgroundTransparency = 1
ControlsFrame.Parent = MainPanel
local InstructionsFrame = Instance.new("Frame")
InstructionsFrame.Name = "InstructionsFrame"
InstructionsFrame.Size = UDim2.new(1, 0, 1, -35)
InstructionsFrame.Position = UDim2.new(0, 0, 0, 35)
InstructionsFrame.BackgroundTransparency = 1
InstructionsFrame.Visible = false
InstructionsFrame.Parent = MainPanel
-- Smooth Menu Toggle Logic Function
local function toggleMenu(show)
if show then
MainCanvas.Visible = true
TweenService:Create(MainCanvas, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {GroupTransparency = 0}):Play()
refreshPlayerList()
else
local tween = TweenService:Create(MainCanvas, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.In), {GroupTransparency = 1})
tween:Play()
tween.Completed:Connect(function()
if not menuVisible then MainCanvas.Visible = false end
end)
end
end
-- Close Menu Button ("X")
local CloseButton = Instance.new("TextButton")
CloseButton.Name = "CloseButton"
CloseButton.Size = UDim2.new(0, 24, 0, 24)
CloseButton.Position = UDim2.new(1, -28, 0, 6)
CloseButton.BackgroundColor3 = Color3.fromRGB(20, 25, 35)
CloseButton.Text = "×"
CloseButton.TextColor3 = Color3.fromRGB(220, 60, 60)
CloseButton.Font = Enum.Font.GothamBold
CloseButton.TextSize = 18
CloseButton.Parent = MainPanel
local CloseCorner = Instance.new("UICorner")
CloseCorner.CornerRadius = UDim.new(0, 4)
CloseCorner.Parent = CloseButton
local CloseStroke = Instance.new("UIStroke")
CloseStroke.Thickness = 1
CloseStroke.Color = Color3.fromRGB(70, 25, 25)
CloseStroke.Parent = CloseButton
CloseButton.MouseButton1Click:Connect(function()
menuVisible = false
showingInstructions = false
ControlsFrame.Visible = true
InstructionsFrame.Visible = false
toggleMenu(false)
end)
-- Help/Instructions Button ("?")
local HelpButton = Instance.new("TextButton")
HelpButton.Name = "HelpButton"
HelpButton.Size = UDim2.new(0, 24, 0, 24)
HelpButton.Position = UDim2.new(1, -56, 0, 6)
HelpButton.BackgroundColor3 = Color3.fromRGB(25, 30, 45)
HelpButton.Text = "?"
HelpButton.TextColor3 = Color3.fromRGB(100, 160, 255)
HelpButton.Font = Enum.Font.GothamBold
HelpButton.TextSize = 14
HelpButton.Parent = MainPanel
local HelpCorner = Instance.new("UICorner")
HelpCorner.CornerRadius = UDim.new(0, 4)
HelpCorner.Parent = HelpButton
local HelpStroke = Instance.new("UIStroke")
HelpStroke.Thickness = 1
HelpStroke.Color = Color3.fromRGB(35, 55, 95)
HelpStroke.Parent = HelpButton
HelpButton.MouseButton1Click:Connect(function()
showingInstructions = not showingInstructions
if showingInstructions then
ControlsFrame.Visible = false
InstructionsFrame.Visible = true
else
InstructionsFrame.Visible = false
ControlsFrame.Visible = true
end
end)
-- Scrolling Selection Box Layout Setup
local PlayerList = Instance.new("ScrollingFrame")
PlayerList.Size = UDim2.new(0.9, 0, 0.45, 0)
PlayerList.Position = UDim2.new(0.05, 0, 0.02, 0)
PlayerList.BackgroundColor3 = Color3.fromRGB(8, 9, 13)
PlayerList.BorderSizePixel = 0
PlayerList.CanvasSize = UDim2.new(0, 0, 0, 0)
PlayerList.ScrollBarThickness = 4
PlayerList.ScrollBarImageColor3 = Color3.fromRGB(45, 55, 80)
PlayerList.Parent = ControlsFrame
local ListCorner = Instance.new("UICorner")
ListCorner.CornerRadius = UDim.new(0, 6)
ListCorner.Parent = PlayerList
local ListStroke = Instance.new("UIStroke")
ListStroke.Thickness = 1
ListStroke.Color = Color3.fromRGB(255, 255, 255)
ListStroke.Parent = PlayerList
applyBorderGradient(ListStroke)
local UIListLayout = Instance.new("UIListLayout")
UIListLayout.SortOrder = Enum.SortOrder.Name
UIListLayout.Padding = UDim.new(0, 5)
UIListLayout.Parent = PlayerList
local ListPadding = Instance.new("UIPadding")
ListPadding.PaddingTop = UDim.new(0, 6)
ListPadding.PaddingBottom = UDim.new(0, 6)
ListPadding.PaddingLeft = UDim.new(0, 6)
ListPadding.PaddingRight = UDim.new(0, 6)
ListPadding.Parent = PlayerList
-- Setup Interactive Dual-Input FOV Layout
local FOVLabel = Instance.new("TextLabel")
FOVLabel.Size = UDim2.new(0.5, 0, 0, 20)
FOVLabel.Position = UDim2.new(0.05, 0, 0.54, 0)
FOVLabel.BackgroundTransparency = 1
FOVLabel.Text = "Field of View"
FOVLabel.TextColor3 = Color3.fromRGB(180, 190, 210)
FOVLabel.Font = Enum.Font.GothamSemibold
FOVLabel.TextSize = 12
FOVLabel.TextXAlignment = Enum.TextXAlignment.Left
FOVLabel.Parent = ControlsFrame
local FOVTextBox = Instance.new("TextBox")
FOVTextBox.Size = UDim2.new(0.35, 0, 0, 20)
FOVTextBox.Position = UDim2.new(0.6, 0, 0.54, 0)
FOVTextBox.BackgroundColor3 = Color3.fromRGB(12, 14, 20)
FOVTextBox.Text = tostring(targetFov)
FOVTextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
FOVTextBox.Font = Enum.Font.Code
FOVTextBox.TextSize = 12
FOVTextBox.ClipsDescendants = true
FOVTextBox.Parent = ControlsFrame
local BoxCorner = Instance.new("UICorner")
BoxCorner.CornerRadius = UDim.new(0, 4)
BoxCorner.Parent = FOVTextBox
local BoxStroke = Instance.new("UIStroke")
BoxStroke.Thickness = 1
BoxStroke.Color = Color3.fromRGB(255, 255, 255)
BoxStroke.Parent = FOVTextBox
applyBorderGradient(BoxStroke)
local FOVSliderBar = Instance.new("TextButton")
FOVSliderBar.Size = UDim2.new(0.9, 0, 0, 6)
FOVSliderBar.Position = UDim2.new(0.05, 0, 0.63, 0)
FOVSliderBar.BackgroundColor3 = Color3.fromRGB(15, 18, 26)
FOVSliderBar.Text = ""
FOVSliderBar.AutoButtonColor = false
FOVSliderBar.Parent = ControlsFrame
local BarStroke = Instance.new("UIStroke")
BarStroke.Thickness = 1
BarStroke.Color = Color3.fromRGB(255, 255, 255)
BarStroke.Parent = FOVSliderBar
applyBorderGradient(BarStroke)
local FOVSliderFill = Instance.new("Frame")
FOVSliderFill.Size = UDim2.new((targetFov - 20) / (120 - 20), 0, 1, 0)
FOVSliderFill.BackgroundColor3 = Color3.fromRGB(40, 90, 180)
FOVSliderFill.BorderSizePixel = 0
FOVSliderFill.Parent = FOVSliderBar
-- Tracking Smoothness Config Slider Elements
local SmoothLabel = Instance.new("TextLabel")
SmoothLabel.Size = UDim2.new(0.9, 0, 0, 20)
SmoothLabel.Position = UDim2.new(0.05, 0, 0.72, 0)
SmoothLabel.BackgroundTransparency = 1
SmoothLabel.Text = "Tracking Smoothness: " .. tostring(smoothingWeight)
SmoothLabel.TextColor3 = Color3.fromRGB(180, 190, 210)
SmoothLabel.Font = Enum.Font.GothamSemibold
SmoothLabel.TextSize = 12
SmoothLabel.TextXAlignment = Enum.TextXAlignment.Left
SmoothLabel.Parent = ControlsFrame
local SmoothSliderBar = Instance.new("TextButton")
SmoothSliderBar.Size = UDim2.new(0.9, 0, 0, 6)
SmoothSliderBar.Position = UDim2.new(0.05, 0, 0.81, 0)
SmoothSliderBar.BackgroundColor3 = Color3.fromRGB(15, 18, 26)
SmoothSliderBar.Text = ""
SmoothSliderBar.AutoButtonColor = false
SmoothSliderBar.Parent = ControlsFrame
local SmoothStroke = Instance.new("UIStroke")
SmoothStroke.Thickness = 1
SmoothStroke.Color = Color3.fromRGB(255, 255, 255)
SmoothStroke.Parent = SmoothSliderBar
applyBorderGradient(SmoothStroke)
local SmoothSliderFill = Instance.new("Frame")
SmoothSliderFill.Size = UDim2.new((smoothingWeight - 1) / (30 - 1), 0, 1, 0)
SmoothSliderFill.BackgroundColor3 = Color3.fromRGB(40, 90, 180)
SmoothSliderFill.BorderSizePixel = 0
SmoothSliderFill.Parent = SmoothSliderBar
-- Building the Inside View of Instructions Pane
local GuideScroller = Instance.new("ScrollingFrame")
GuideScroller.Size = UDim2.new(0.9, 0, 0.8, 0)
GuideScroller.Position = UDim2.new(0.05, 0, 0.02, 0)
GuideScroller.BackgroundColor3 = Color3.fromRGB(8, 9, 13)
GuideScroller.BorderSizePixel = 0
GuideScroller.CanvasSize = UDim2.new(0, 0, 0, 290)
GuideScroller.ScrollBarThickness = 4
GuideScroller.ScrollBarImageColor3 = Color3.fromRGB(45, 55, 80)
GuideScroller.Parent = InstructionsFrame
local GuideCorner = Instance.new("UICorner")
GuideCorner.CornerRadius = UDim.new(0, 6)
GuideCorner.Parent = GuideScroller
local GuideStroke = Instance.new("UIStroke")
GuideStroke.Thickness = 1
GuideStroke.Color = Color3.fromRGB(255, 255, 255)
GuideStroke.Parent = GuideScroller
applyBorderGradient(GuideStroke)
local GuideText = Instance.new("TextLabel")
GuideText.Size = UDim2.new(1, -16, 1, 0)
GuideText.Position = UDim2.new(0, 8, 0, 5)
GuideText.BackgroundTransparency = 1
GuideText.Text = "<b>[SYSTEM CONTROLS]</b>\n" ..
"• <b>F4</b> : Toggle Freecam Mode On/Off\n" ..
"• <b>K</b> : Open / Close This Control Layout\n\n" ..
"<b>[ORBIT CONTROL MOVEMENTS]</b>\n" ..
"• <b>A / D</b> : Orbit Left / Right around targets\n" ..
"• <b>E / Q</b> : Orbit Vertically Up / Down\n" ..
"• <b>W / S</b> : Zoom Camera Distance In / Out\n" ..
"• <b>Hold Left Shift</b> : Speed up orbit panning acceleration\n" ..
"• <b>Hold Right Click</b> : Lock Cursor & Look Around\n\n" ..
"<b>[SPEED MODIFIERS]</b>\n" ..
"• <b>] (Right Bracket)</b> : Increase default speed\n" ..
"• <b>[ (Left Bracket)</b> : Decrease default speed\n\n" ..
"<b>[CINEMATIC PLAYER TRACKING]</b>\n" ..
"Select single or multiple players from the panel roster. The camera will dynamically compute the fluid midpoint tracking position seamlessly."
GuideText.TextColor3 = Color3.fromRGB(200, 210, 230)
GuideText.Font = Enum.Font.Gotham
GuideText.TextSize = 11
GuideText.TextWrapped = true
GuideText.RichText = true
GuideText.TextYAlignment = Enum.TextYAlignment.Top
GuideText.TextXAlignment = Enum.TextXAlignment.Left
GuideText.Parent = GuideScroller
local ReturnButton = Instance.new("TextButton")
ReturnButton.Size = UDim2.new(0.9, 0, 0.12, 0)
ReturnButton.Position = UDim2.new(0.05, 0, 0.85, 0)
ReturnButton.BackgroundColor3 = Color3.fromRGB(25, 35, 55)
ReturnButton.Text = "Back to Panel"
ReturnButton.TextColor3 = Color3.fromRGB(255, 255, 255)
ReturnButton.Font = Enum.Font.GothamBold
ReturnButton.TextSize = 11
ReturnButton.Parent = InstructionsFrame
local ReturnCorner = Instance.new("UICorner")
ReturnCorner.CornerRadius = UDim.new(0, 4)
ReturnCorner.Parent = ReturnButton
ReturnButton.MouseButton1Click:Connect(function()
showingInstructions = false
InstructionsFrame.Visible = false
ControlsFrame.Visible = true
end)
-- Pop-up Tracking Status Notification Card
local NotificationFrame = Instance.new("Frame")
NotificationFrame.Name = "NotificationFrame"
NotificationFrame.Size = UDim2.new(0, 280, 0, 65)
NotificationFrame.Position = UDim2.new(1, 300, 1, -85)
NotificationFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
NotificationFrame.BorderSizePixel = 0
NotificationFrame.Parent = ScreenGui
applyDarkGradient(NotificationFrame)
local NotifCorner = Instance.new("UICorner")
NotifCorner.CornerRadius = UDim.new(0, 6)
NotifCorner.Parent = NotificationFrame
local NotifStroke = Instance.new("UIStroke")
NotifStroke.Thickness = 1.5
NotifStroke.Color = Color3.fromRGB(255, 255, 255)
NotifStroke.Parent = NotificationFrame
applyBorderGradient(NotifStroke)
local NotifText = Instance.new("TextLabel")
NotifText.Size = UDim2.new(1, -20, 1, 0)
NotifText.Position = UDim2.new(0, 10, 0, 0)
NotifText.BackgroundTransparency = 1
NotifText.Text = "<b>Freecam Loaded!</b>\nPress [<b>F4</b>] to toggle camera\nPress [<b>K</b>] to toggle UI setup panel"
NotifText.TextColor3 = Color3.fromRGB(215, 225, 245)
NotifText.Font = Enum.Font.Gotham
NotifText.TextSize = 12
NotifText.RichText = true
NotifText.TextWrapped = true
NotifText.Parent = NotificationFrame
-- Real-time UI Engine Mapping Functions
local function updateFovVisuals(val)
targetFov = math.clamp(val, 20, 120)
FOVTextBox.Text = tostring(math.round(targetFov))
FOVSliderFill.Size = UDim2.new((targetFov - 20) / (120 - 20), 0, 1, 0)
end
local fovSliderDragging = false
FOVSliderBar.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then fovSliderDragging = true end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then fovSliderDragging = false end
end)
UserInputService.InputChanged:Connect(function(input)
if fovSliderDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local mousePos = UserInputService:GetMouseLocation().X
local barPos = FOVSliderBar.AbsolutePosition.X
local barWidth = FOVSliderBar.AbsoluteSize.X
local pct = math.clamp((mousePos - barPos) / barWidth, 0, 1)
local val = 20 + (pct * (120 - 20))
updateFovVisuals(val)
end
end)
FOVTextBox.FocusLost:Connect(function(enterPressed)
local num = tonumber(FOVTextBox.Text)
if num then updateFovVisuals(num) else FOVTextBox.Text = tostring(math.round(targetFov)) end
end)
local smoothDragging = false
SmoothSliderBar.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then smoothDragging = true end
end)
UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then smoothDragging = false end
end)
UserInputService.InputChanged:Connect(function(input)
if smoothDragging and input.UserInputType == Enum.UserInputType.MouseMovement then
local mousePos = UserInputService:GetMouseLocation().X
local barPos = SmoothSliderBar.AbsolutePosition.X
local barWidth = SmoothSliderBar.AbsoluteSize.X
local pct = math.clamp((mousePos - barPos) / barWidth, 0, 1)
smoothingWeight = math.round(1 + (pct * (30 - 1)))
SmoothLabel.Text = "Tracking Smoothness: " .. tostring(smoothingWeight)
SmoothSliderFill.Size = UDim2.new((smoothingWeight - 1) / (30 - 1), 0, 1, 0)
end
end)
local function setMovementEnabled(enabled)
pcall(function()
local PlayerModule = require(player.PlayerScripts:WaitForChild("PlayerModule", 5))
if PlayerModule then
local controls = PlayerModule:GetControls()
if enabled then controls:Enable() else controls:Disable() end
end
end)
end
local function getTrackingCenter()
local activePositions = {}
for id, p in pairs(targets) do
if p and p.Parent == Players and p.Character and p.Character:FindFirstChild("Head") then
table.insert(activePositions, p.Character.Head.Position)
end
end
if #activePositions > 0 then
local trackingCenter = Vector3.new(0, 0, 0)
for _, pos in ipairs(activePositions) do
trackingCenter = trackingCenter + pos
end
return trackingCenter / #activePositions
end
return nil
end
function refreshPlayerList()
for _, child in ipairs(PlayerList:GetChildren()) do
if child:IsA("TextButton") then child:Destroy() end
end
for _, p in ipairs(Players:GetPlayers()) do
local isCurrentlySelected = (targets[p.UserId] ~= nil)
local btn = Instance.new("TextButton")
btn.Size = UDim2.new(1, -12, 0, 30)
btn.Text = " " .. p.DisplayName .. " (@" .. p.Name .. ")"
btn.TextColor3 = isCurrentlySelected and Color3.fromRGB(255, 255, 255) or Color3.fromRGB(195, 200, 210)
btn.Font = isCurrentlySelected and Enum.Font.GothamBold or Enum.Font.Gotham
btn.TextSize = 11
btn.TextXAlignment = Enum.TextXAlignment.Left
btn.BorderSizePixel = 0
btn.Parent = PlayerList
local btnCorner = Instance.new("UICorner")
btnCorner.CornerRadius = UDim.new(0, 4)
btnCorner.Parent = btn
local btnStroke = Instance.new("UIStroke")
btnStroke.Thickness = isCurrentlySelected and 1.5 or 1
btnStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
btnStroke.Parent = btn
if isCurrentlySelected then
btn.BackgroundColor3 = Color3.fromRGB(46, 57, 92)
btnStroke.Color = Color3.fromRGB(80, 140, 255)
else
btn.BackgroundColor3 = Color3.fromRGB(22, 25, 38)
applyBorderGradient(btnStroke)
end
btn.MouseButton1Click:Connect(function()
if targets[p.UserId] then
targets[p.UserId] = nil
btn.TextColor3 = Color3.fromRGB(195, 200, 210)
btn.Font = Enum.Font.Gotham
local grad = btn:FindFirstChildOfClass("UIGradient")
if grad then grad:Destroy() end
btnStroke:Destroy()
btn.BackgroundColor3 = Color3.fromRGB(22, 25, 38)
btnStroke = Instance.new("UIStroke")
btnStroke.Thickness = 1
btnStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
btnStroke.Parent = btn
applyBorderGradient(btnStroke)
else
targets[p.UserId] = p
btn.TextColor3 = Color3.fromRGB(255, 255, 255)
btn.Font = Enum.Font.GothamBold
local grad = btn:FindFirstChildOfClass("UIGradient")
if grad then grad:Destroy() end
btn.BackgroundColor3 = Color3.fromRGB(46, 57, 92)
btnStroke.Color = Color3.fromRGB(80, 140, 255)
btnStroke.Thickness = 1.5
local center = getTrackingCenter()
if center then
orbitDistance = (camera.CFrame.Position - center).Magnitude
if orbitDistance < 4 then orbitDistance = 20 end
end
end
end)
end
PlayerList.CanvasSize = UDim2.new(0, 0, 0, UIListLayout.AbsoluteContentSize.Y + 12)
end
Players.PlayerAdded:Connect(refreshPlayerList)
Players.PlayerRemoving:Connect(function(p) targets[p.UserId] = nil; refreshPlayerList() end)
-- Handle Inputs
UserInputService.InputBegan:Connect(function(input, processed)
if active then
if input.KeyCode == SPEED_UP_KEY then
flySpeed = math.clamp(flySpeed + speedStep, minSpeed, maxSpeed)
return
elseif input.KeyCode == SPEED_DOWN_KEY then
flySpeed = math.clamp(flySpeed - speedStep, minSpeed, maxSpeed)
return
end
end
if processed then return end
-- "K" Setup Menu Trigger
if input.KeyCode == MENU_KEY then
menuVisible = not menuVisible
toggleMenu(menuVisible)
end
-- Main Freecam Activation Toggle (F4)
if input.KeyCode == TOGGLE_KEY then
active = not active
if active then
savedDefaultFov = camera.FieldOfView
setMovementEnabled(false)
camera.CameraType = Enum.CameraType.Scriptable
camCFrame = camera.CFrame
local rx, ry, _ = camera.CFrame:ToEulerAnglesYXZ()
rotationX = math.deg(ry)
rotationY = math.clamp(math.deg(rx), -85, 85)
local center = getTrackingCenter()
if center then
orbitDistance = (camera.CFrame.Position - center).Magnitude
if orbitDistance < 4 then orbitDistance = 20 end
end
else
setMovementEnabled(true)
camera.CameraType = Enum.CameraType.Custom
camera.FieldOfView = savedDefaultFov
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
if active then
if input.KeyCode == Enum.KeyCode.W then movement.W = 1 end
if input.KeyCode == Enum.KeyCode.S then movement.S = 1 end
if input.KeyCode == Enum.KeyCode.A then movement.A = 1 end
if input.KeyCode == Enum.KeyCode.D then movement.D = 1 end
if input.KeyCode == Enum.KeyCode.E then movement.E = 1 end
if input.KeyCode == Enum.KeyCode.Q then movement.Q = 1 end
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then movement.W = 0 end
if input.KeyCode == Enum.KeyCode.S then movement.S = 0 end
if input.KeyCode == Enum.KeyCode.A then movement.A = 0 end
if input.KeyCode == Enum.KeyCode.D then movement.D = 0 end
if input.KeyCode == Enum.KeyCode.E then movement.E = 0 end
if input.KeyCode == Enum.KeyCode.Q then movement.Q = 0 end
end)
-- Main Loop Runtime
getgenv().IY_Style_Freecam = RunService.RenderStepped:Connect(function(dt)
if not active then return end
camera.FieldOfView = camera.FieldOfView + (targetFov - camera.FieldOfView) * math.clamp(dt * 12, 0, 1)
local isPanActive = UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)
if isPanActive then
if not FOVTextBox:IsFocused() then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
local delta = UserInputService:GetMouseDelta()
rotationX = rotationX - (delta.X * sensitivity)
rotationY = math.clamp(rotationY - (delta.Y * sensitivity), -85, 85)
end
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
local currentSpeed = tonumber(flySpeed) or 1.0
if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
currentSpeed = currentSpeed * shiftMultiplier
end
local trackingCenter = getTrackingCenter()
if trackingCenter then
local angularSpeed = currentSpeed * 65 * dt
if movement.A == 1 then rotationX = rotationX - angularSpeed end
if movement.D == 1 then rotationX = rotationX + angularSpeed end
if movement.E == 1 then rotationY = math.clamp(rotationY - angularSpeed, -85, 85) end
if movement.Q == 1 then rotationY = math.clamp(rotationY + angularSpeed, -85, 85) end
-- SPEED FIX: Re-scaled distance velocity down from 22 to 10 to balance perfectly with the rotation pacing
if movement.W == 1 then orbitDistance = math.max(orbitDistance - (currentSpeed * 10 * dt), 3) end
if movement.S == 1 then orbitDistance = orbitDistance + (currentSpeed * 10 * dt) end
local rotationMatrix = CFrame.Angles(0, math.rad(rotationX), 0) * CFrame.Angles(math.rad(rotationY), 0, 0)
local targetPos = trackingCenter + (rotationMatrix * Vector3.new(0, 0, orbitDistance))
camCFrame = CFrame.new(targetPos) * rotationMatrix
local mappedLerpSpeed = 31 - math.clamp(smoothingWeight, 1, 30)
camera.CFrame = camera.CFrame:Lerp(CFrame.new(camCFrame.Position, trackingCenter), math.clamp(dt * mappedLerpSpeed, 0, 1))
else
-- Standard Fly Mode
local direction = Vector3.new(movement.D - movement.A, movement.E - movement.Q, movement.S - movement.W)
local rotationMatrix = CFrame.Angles(0, math.rad(rotationX), 0) * CFrame.Angles(math.rad(rotationY), 0, 0)
local moveVector = rotationMatrix:VectorToWorldSpace(direction) * (currentSpeed * 15 * dt)
camCFrame = camCFrame + moveVector
local rawTargetCFrame = CFrame.new(camCFrame.Position) * rotationMatrix
if isPanActive then
camera.CFrame = rawTargetCFrame
else
camera.CFrame = camera.CFrame:Lerp(rawTargetCFrame, math.clamp(dt * 15, 0, 1))
end
end
end)
-- Notification Slide-In
task.spawn(function()
task.wait(0.5)
TweenService:Create(NotificationFrame, TweenInfo.new(0.6, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out), {
Position = UDim2.new(1, -295, 1, -85)
}):Play()
task.wait(5.0)
local closeTween = TweenService:Create(NotificationFrame, TweenInfo.new(0.6, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {
Position = UDim2.new(1, 300, 1, -85)
})
closeTween:Play()
closeTween.Completed:Connect(function() NotificationFrame:Destroy() end)
end)