Загрузка данных
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Lighting = game:GetService("Lighting")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
--------------------------------------------------
-- SETTINGS
--------------------------------------------------
local SAMPLE_TIME = 5
local HIGH_FPS = 55
local MEDIUM_FPS = 35
--------------------------------------------------
-- VARIABLES
--------------------------------------------------
local selectedMode = "AUTO"
local currentQuality = "MEDIUM"
local frames = 0
local elapsed = 0
local averageFPS = 60
--------------------------------------------------
-- EFFECTS
--------------------------------------------------
local colorCorrection
local bloom
local sunRays
--------------------------------------------------
-- CREATE LOCAL EFFECTS
--------------------------------------------------
local function createEffects()
local camera = workspace.CurrentCamera
if not camera then
return
end
--------------------------------------------------
-- COLOR CORRECTION
--------------------------------------------------
colorCorrection =
camera:FindFirstChild("LocalRTXColorCorrection")
if not colorCorrection then
colorCorrection =
Instance.new("ColorCorrectionEffect")
colorCorrection.Name =
"LocalRTXColorCorrection"
colorCorrection.Parent = camera
end
--------------------------------------------------
-- BLOOM
--------------------------------------------------
bloom =
camera:FindFirstChild("LocalRTXBloom")
if not bloom then
bloom =
Instance.new("BloomEffect")
bloom.Name =
"LocalRTXBloom"
bloom.Parent = camera
end
--------------------------------------------------
-- SUN RAYS
--------------------------------------------------
sunRays =
camera:FindFirstChild("LocalRTXSunRays")
if not sunRays then
sunRays =
Instance.new("SunRaysEffect")
sunRays.Name =
"LocalRTXSunRays"
sunRays.Parent = camera
end
end
createEffects()
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
task.wait()
createEffects()
end)
--------------------------------------------------
-- QUALITY
--------------------------------------------------
local function setQuality(quality)
currentQuality = quality
createEffects()
if not colorCorrection
or not bloom
or not sunRays then
return
end
--------------------------------------------------
-- HIGH
--------------------------------------------------
if quality == "HIGH" then
colorCorrection.Brightness = 0.02
colorCorrection.Contrast = 0.12
colorCorrection.Saturation = 0.08
bloom.Enabled = true
bloom.Intensity = 0.18
bloom.Size = 24
bloom.Threshold = 0.8
sunRays.Enabled = true
sunRays.Intensity = 0.055
sunRays.Spread = 0.9
--------------------------------------------------
-- MEDIUM
--------------------------------------------------
elseif quality == "MEDIUM" then
colorCorrection.Brightness = 0
colorCorrection.Contrast = 0.08
colorCorrection.Saturation = 0.04
bloom.Enabled = true
bloom.Intensity = 0.08
bloom.Size = 18
bloom.Threshold = 1
sunRays.Enabled = true
sunRays.Intensity = 0.025
sunRays.Spread = 0.75
--------------------------------------------------
-- LOW
--------------------------------------------------
elseif quality == "LOW" then
colorCorrection.Brightness = 0
colorCorrection.Contrast = 0.03
colorCorrection.Saturation = 0
bloom.Enabled = false
sunRays.Enabled = false
end
end
--------------------------------------------------
-- GUI
--------------------------------------------------
local oldGui = playerGui:FindFirstChild("RTXSettings")
if oldGui then
oldGui:Destroy()
end
local gui = Instance.new("ScreenGui")
gui.Name = "RTXSettings"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = true
gui.Parent = playerGui
--------------------------------------------------
-- OPEN BUTTON
--------------------------------------------------
local openButton = Instance.new("TextButton")
openButton.Name = "OpenButton"
openButton.Size =
UDim2.fromOffset(48, 48)
openButton.Position =
UDim2.new(1, -65, 0, 20)
openButton.BackgroundColor3 =
Color3.fromRGB(22, 22, 25)
openButton.BackgroundTransparency = 0.1
openButton.Text = "⚙"
openButton.TextColor3 =
Color3.new(1, 1, 1)
openButton.TextSize = 25
openButton.Font =
Enum.Font.GothamBold
openButton.Parent = gui
local openCorner =
Instance.new("UICorner")
openCorner.CornerRadius =
UDim.new(0, 14)
openCorner.Parent = openButton
--------------------------------------------------
-- PANEL
--------------------------------------------------
local panel = Instance.new("Frame")
panel.Name = "SettingsPanel"
panel.Size =
UDim2.fromOffset(330, 330)
panel.Position =
UDim2.new(0.5, -165, 0.5, -165)
panel.BackgroundColor3 =
Color3.fromRGB(15, 15, 18)
panel.BackgroundTransparency = 0.03
panel.Visible = false
panel.Parent = gui
local panelCorner =
Instance.new("UICorner")
panelCorner.CornerRadius =
UDim.new(0, 18)
panelCorner.Parent = panel
local panelStroke =
Instance.new("UIStroke")
panelStroke.Thickness = 1
panelStroke.Transparency = 0.3
panelStroke.Parent = panel
--------------------------------------------------
-- TITLE
--------------------------------------------------
local title = Instance.new("TextLabel")
title.Size =
UDim2.new(1, -60, 0, 45)
title.Position =
UDim2.fromOffset(20, 12)
title.BackgroundTransparency = 1
title.Text = "GRAPHICS"
title.TextColor3 =
Color3.new(1, 1, 1)
title.TextSize = 22
title.Font =
Enum.Font.GothamBold
title.TextXAlignment =
Enum.TextXAlignment.Left
title.Parent = panel
--------------------------------------------------
-- SUBTITLE
--------------------------------------------------
local subtitle = Instance.new("TextLabel")
subtitle.Size =
UDim2.new(1, -40, 0, 25)
subtitle.Position =
UDim2.fromOffset(20, 52)
subtitle.BackgroundTransparency = 1
subtitle.Text =
"RTX Lighting Quality"
subtitle.TextColor3 =
Color3.fromRGB(150, 150, 155)
subtitle.TextSize = 14
subtitle.Font =
Enum.Font.Gotham
subtitle.TextXAlignment =
Enum.TextXAlignment.Left
subtitle.Parent = panel
--------------------------------------------------
-- CLOSE
--------------------------------------------------
local closeButton =
Instance.new("TextButton")
closeButton.Size =
UDim2.fromOffset(35, 35)
closeButton.Position =
UDim2.new(1, -48, 0, 12)
closeButton.BackgroundTransparency = 1
closeButton.Text = "×"
closeButton.TextColor3 =
Color3.fromRGB(190, 190, 195)
closeButton.TextSize = 28
closeButton.Font =
Enum.Font.Gotham
closeButton.Parent = panel
--------------------------------------------------
-- FPS
--------------------------------------------------
local fpsLabel =
Instance.new("TextLabel")
fpsLabel.Size =
UDim2.new(1, -40, 0, 25)
fpsLabel.Position =
UDim2.fromOffset(20, 85)
fpsLabel.BackgroundTransparency = 1
fpsLabel.Text = "FPS: --"
fpsLabel.TextColor3 =
Color3.fromRGB(190, 190, 195)
fpsLabel.TextSize = 14
fpsLabel.Font =
Enum.Font.GothamMedium
fpsLabel.TextXAlignment =
Enum.TextXAlignment.Left
fpsLabel.Parent = panel
--------------------------------------------------
-- QUALITY LABEL
--------------------------------------------------
local qualityLabel =
Instance.new("TextLabel")
qualityLabel.Size =
UDim2.new(1, -40, 0, 25)
qualityLabel.Position =
UDim2.fromOffset(20, 115)
qualityLabel.BackgroundTransparency = 1
qualityLabel.Text = "Quality Mode"
qualityLabel.TextColor3 =
Color3.fromRGB(220, 220, 225)
qualityLabel.TextSize = 14
qualityLabel.Font =
Enum.Font.GothamMedium
qualityLabel.TextXAlignment =
Enum.TextXAlignment.Left
qualityLabel.Parent = panel
--------------------------------------------------
-- BUTTONS
--------------------------------------------------
local modes = {
"AUTO",
"LOW",
"MEDIUM",
"HIGH"
}
local buttons = {}
local function updateButtonVisuals()
for mode, button in pairs(buttons) do
if selectedMode == mode then
button.BackgroundColor3 =
Color3.fromRGB(55, 55, 62)
else
button.BackgroundColor3 =
Color3.fromRGB(28, 28, 32)
end
end
end
local function createButton(mode, index)
local button =
Instance.new("TextButton")
button.Name =
mode .. "Button"
button.Size =
UDim2.new(1, -40, 0, 38)
button.Position =
UDim2.fromOffset(
20,
140 + (index - 1) * 43
)
button.BackgroundColor3 =
Color3.fromRGB(28, 28, 32)
button.Text = mode
button.TextColor3 =
Color3.fromRGB(225, 225, 230)
button.TextSize = 14
button.Font =
Enum.Font.GothamBold
button.Parent = panel
local corner =
Instance.new("UICorner")
corner.CornerRadius =
UDim.new(0, 10)
corner.Parent = button
button.MouseEnter:Connect(function()
if selectedMode ~= mode then
TweenService:Create(
button,
TweenInfo.new(0.12),
{
BackgroundColor3 =
Color3.fromRGB(42, 42, 48)
}
):Play()
end
end)
button.MouseLeave:Connect(function()
if selectedMode ~= mode then
TweenService:Create(
button,
TweenInfo.new(0.12),
{
BackgroundColor3 =
Color3.fromRGB(28, 28, 32)
}
):Play()
end
end)
button.MouseButton1Click:Connect(function()
selectedMode = mode
if mode == "AUTO" then
if averageFPS >= HIGH_FPS then
setQuality("HIGH")
elseif averageFPS >= MEDIUM_FPS then
setQuality("MEDIUM")
else
setQuality("LOW")
end
else
setQuality(mode)
end
updateButtonVisuals()
end)
buttons[mode] = button
end
for index, mode in ipairs(modes) do
createButton(mode, index)
end
--------------------------------------------------
-- OPEN / CLOSE
--------------------------------------------------
local function openPanel()
panel.Visible = true
panel.Size =
UDim2.fromOffset(300, 300)
TweenService:Create(
panel,
TweenInfo.new(
0.18,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out
),
{
Size =
UDim2.fromOffset(
330,
330
)
}
):Play()
end
local function closePanel()
local tween =
TweenService:Create(
panel,
TweenInfo.new(
0.14,
Enum.EasingStyle.Quad,
Enum.EasingDirection.In
),
{
Size =
UDim2.fromOffset(
300,
300
)
}
)
tween:Play()
tween.Completed:Connect(function()
panel.Visible = false
end)
end
openButton.MouseButton1Click:Connect(openPanel)
closeButton.MouseButton1Click:Connect(closePanel)
--------------------------------------------------
-- FPS MONITOR
--------------------------------------------------
RunService.RenderStepped:Connect(function(deltaTime)
frames += 1
elapsed += deltaTime
if elapsed >= SAMPLE_TIME then
averageFPS =
frames / elapsed
frames = 0
elapsed = 0
fpsLabel.Text =
"FPS: "
.. math.floor(averageFPS)
if selectedMode == "AUTO" then
if averageFPS >= HIGH_FPS then
setQuality("HIGH")
elseif averageFPS >= MEDIUM_FPS then
setQuality("MEDIUM")
else
setQuality("LOW")
end
end
end
end)
--------------------------------------------------
-- START
--------------------------------------------------
setQuality("MEDIUM")
selectedMode = "AUTO"
updateButtonVisuals()
--------------------------------------------------
-- MOBILE
--------------------------------------------------
if UserInputService.TouchEnabled then
openButton.Position =
UDim2.new(1, -65, 0, 70)
end