File size: 5,983 Bytes
0712d5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
-- src/StarterGui/SettingsGUI.client.lua
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)

-- Slider builder
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

-- Volume sliders
createSlider(mainFrame, "Master Volume", 50, 0.8, function(v)
	SoundService.AmbientReverb = Enum.ReverbType.NoReverb
	-- Adjust all sound groups
	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)

-- Toggle with ESC/O key
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)