| |
|
| | local Players = game:GetService("Players")
|
| | local UserInputService = game:GetService("UserInputService")
|
| | local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
| | local SoundService = game:GetService("SoundService")
|
| |
|
| | local player = Players.LocalPlayer
|
| |
|
| | local screenGui = Instance.new("ScreenGui")
|
| | screenGui.Name = "SettingsGUI"
|
| | screenGui.ResetOnSpawn = false
|
| | screenGui.Parent = player:WaitForChild("PlayerGui")
|
| |
|
| | local mainFrame = Instance.new("Frame")
|
| | mainFrame.Name = "SettingsFrame"
|
| | mainFrame.Size = UDim2.new(0, 350, 0, 300)
|
| | mainFrame.Position = UDim2.new(0.5, -175, 0.5, -150)
|
| | mainFrame.BackgroundColor3 = Color3.fromRGB(25, 28, 35)
|
| | mainFrame.BackgroundTransparency = 0.05
|
| | mainFrame.BorderSizePixel = 0
|
| | mainFrame.Visible = false
|
| | mainFrame.Parent = screenGui
|
| |
|
| | local corner = Instance.new("UICorner")
|
| | corner.CornerRadius = UDim.new(0, 12)
|
| | corner.Parent = mainFrame
|
| |
|
| | local stroke = Instance.new("UIStroke")
|
| | stroke.Color = Color3.fromRGB(120, 120, 140)
|
| | stroke.Thickness = 2
|
| | stroke.Parent = mainFrame
|
| |
|
| | local titleBar = Instance.new("Frame")
|
| | titleBar.Size = UDim2.new(1, 0, 0, 38)
|
| | titleBar.BackgroundColor3 = Color3.fromRGB(60, 60, 80)
|
| | titleBar.BorderSizePixel = 0
|
| | titleBar.Parent = mainFrame
|
| |
|
| | local titleCorner = Instance.new("UICorner")
|
| | titleCorner.CornerRadius = UDim.new(0, 12)
|
| | titleCorner.Parent = titleBar
|
| |
|
| | local titleLabel = Instance.new("TextLabel")
|
| | titleLabel.Size = UDim2.new(1, -50, 1, 0)
|
| | titleLabel.Position = UDim2.new(0, 15, 0, 0)
|
| | titleLabel.BackgroundTransparency = 1
|
| | titleLabel.Text = "Settings"
|
| | titleLabel.TextColor3 = Color3.new(1, 1, 1)
|
| | titleLabel.TextScaled = true
|
| | titleLabel.Font = Enum.Font.GothamBold
|
| | titleLabel.TextXAlignment = Enum.TextXAlignment.Left
|
| | titleLabel.Parent = titleBar
|
| |
|
| | local closeBtn = Instance.new("TextButton")
|
| | closeBtn.Size = UDim2.new(0, 28, 0, 28)
|
| | closeBtn.Position = UDim2.new(1, -33, 0, 5)
|
| | closeBtn.BackgroundColor3 = Color3.fromRGB(180, 50, 50)
|
| | closeBtn.Text = "X"
|
| | closeBtn.TextColor3 = Color3.new(1, 1, 1)
|
| | closeBtn.TextScaled = true
|
| | closeBtn.Font = Enum.Font.GothamBold
|
| | closeBtn.Parent = titleBar
|
| |
|
| | local closeCorner = Instance.new("UICorner")
|
| | closeCorner.CornerRadius = UDim.new(0, 6)
|
| | closeCorner.Parent = closeBtn
|
| |
|
| | closeBtn.MouseButton1Click:Connect(function()
|
| | mainFrame.Visible = false
|
| | end)
|
| |
|
| |
|
| | local function createSlider(parent, label, yPos, initial, callback)
|
| | local sliderFrame = Instance.new("Frame")
|
| | sliderFrame.Size = UDim2.new(1, -30, 0, 40)
|
| | sliderFrame.Position = UDim2.new(0, 15, 0, yPos)
|
| | sliderFrame.BackgroundTransparency = 1
|
| | sliderFrame.Parent = parent
|
| |
|
| | local nameLabel = Instance.new("TextLabel")
|
| | nameLabel.Size = UDim2.new(0.4, 0, 0, 20)
|
| | nameLabel.BackgroundTransparency = 1
|
| | nameLabel.Text = label
|
| | nameLabel.TextColor3 = Color3.new(1, 1, 1)
|
| | nameLabel.TextScaled = true
|
| | nameLabel.Font = Enum.Font.GothamMedium
|
| | nameLabel.TextXAlignment = Enum.TextXAlignment.Left
|
| | nameLabel.Parent = sliderFrame
|
| |
|
| | local trackBg = Instance.new("Frame")
|
| | trackBg.Size = UDim2.new(0.55, 0, 0, 8)
|
| | trackBg.Position = UDim2.new(0.4, 0, 0.5, -4)
|
| | trackBg.BackgroundColor3 = Color3.fromRGB(40, 40, 50)
|
| | trackBg.BorderSizePixel = 0
|
| | trackBg.Parent = sliderFrame
|
| |
|
| | local trackCorner = Instance.new("UICorner")
|
| | trackCorner.CornerRadius = UDim.new(0, 4)
|
| | trackCorner.Parent = trackBg
|
| |
|
| | local fill = Instance.new("Frame")
|
| | fill.Size = UDim2.new(initial, 0, 1, 0)
|
| | fill.BackgroundColor3 = Color3.fromRGB(80, 140, 220)
|
| | fill.BorderSizePixel = 0
|
| | fill.Parent = trackBg
|
| |
|
| | local fillCorner = Instance.new("UICorner")
|
| | fillCorner.CornerRadius = UDim.new(0, 4)
|
| | fillCorner.Parent = fill
|
| |
|
| | local valueLabel = Instance.new("TextLabel")
|
| | valueLabel.Size = UDim2.new(0, 30, 0, 20)
|
| | valueLabel.Position = UDim2.new(0.96, 0, 0.5, -10)
|
| | valueLabel.BackgroundTransparency = 1
|
| | valueLabel.Text = tostring(math.floor(initial * 100)) .. "%"
|
| | valueLabel.TextColor3 = Color3.fromRGB(180, 180, 200)
|
| | valueLabel.TextScaled = true
|
| | valueLabel.Font = Enum.Font.Gotham
|
| | valueLabel.Parent = sliderFrame
|
| |
|
| | local dragging = false
|
| | trackBg.InputBegan:Connect(function(input)
|
| | if input.UserInputType == Enum.UserInputType.MouseButton1 then
|
| | dragging = true
|
| | end
|
| | end)
|
| | trackBg.InputEnded:Connect(function(input)
|
| | if input.UserInputType == Enum.UserInputType.MouseButton1 then
|
| | dragging = false
|
| | end
|
| | end)
|
| |
|
| | UserInputService.InputChanged:Connect(function(input)
|
| | if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
|
| | local absPos = trackBg.AbsolutePosition.X
|
| | local absSize = trackBg.AbsoluteSize.X
|
| | local relative = math.clamp((input.Position.X - absPos) / absSize, 0, 1)
|
| | fill.Size = UDim2.new(relative, 0, 1, 0)
|
| | valueLabel.Text = tostring(math.floor(relative * 100)) .. "%"
|
| | callback(relative)
|
| | end
|
| | end)
|
| | end
|
| |
|
| |
|
| | createSlider(mainFrame, "Master Volume", 50, 0.8, function(v)
|
| | SoundService.AmbientReverb = Enum.ReverbType.NoReverb
|
| |
|
| | for _, group in pairs(SoundService:GetChildren()) do
|
| | if group:IsA("SoundGroup") then
|
| | group.Volume = v
|
| | end
|
| | end
|
| | end)
|
| |
|
| | createSlider(mainFrame, "SFX Volume", 100, 1.0, function(v)
|
| | local sfx = SoundService:FindFirstChild("SFX")
|
| | if sfx then sfx.Volume = v end
|
| | end)
|
| |
|
| | createSlider(mainFrame, "Ambient Volume", 150, 0.3, function(v)
|
| | local ambient = SoundService:FindFirstChild("Ambient")
|
| | if ambient then ambient.Volume = v end
|
| | end)
|
| |
|
| | createSlider(mainFrame, "Graphics Quality", 200, 0.8, function(v)
|
| | local qualityLevel = math.clamp(math.floor(v * 10) + 1, 1, 10)
|
| | settings().Rendering.QualityLevel = Enum.QualityLevel:GetEnumItems()[qualityLevel] or Enum.QualityLevel.Automatic
|
| | end)
|
| |
|
| |
|
| | UserInputService.InputBegan:Connect(function(input, gameProcessed)
|
| | if gameProcessed then return end
|
| | if input.KeyCode == Enum.KeyCode.O then
|
| | mainFrame.Visible = not mainFrame.Visible
|
| | end
|
| | end)
|
| |
|