-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
70 lines (59 loc) · 1.89 KB
/
main.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
--: Constants
local UIS = game:GetService("UserInputService")
local Lighting = game:GetService("Lighting");
local fixedLighting;
local Time;
local timeToggle = Enum.KeyCode.F3;
--: Better Lighting
local function betterLighting()
Lighting.EnvironmentDiffuseScale = 0.8;
Lighting:FindFirstChild("low_color_correction").Contrast = 0;
for _, v in next, Lighting:GetDescendants() do
if (v:IsA("Atmosphere")) then
v.Density = 0.375;
end
end
end
--: In-game Clock
local function getTime()
local totalMinutes = Lighting:GetMinutesAfterMidnight();
local Hours = math.floor(totalMinutes / 60);
local Minutes = math.floor(totalMinutes % 60);
local Period;
if (Hours < 12) then
Period = "AM";
else
Period = "PM";
Hours -= 12;
end
if (Hours == 0) then
Hours = 12;
end
return string.format("%02d:%02d %s", Hours, Minutes, Period);
end
--: Time UI
local sGUI = Instance.new("ScreenGui");
sGUI.ResetOnSpawn = false;
pcall(function()
if (gethui) then sGUI.Parent = gethui(); else sGUI.Parent = game:GetService("CoreGui"); end
end)
local timeLabel = Instance.new("TextLabel", sGUI);
timeLabel.AnchorPoint = Vector2.new(0.5, 0.5);
timeLabel.BackgroundTransparency = 1;
timeLabel.Position = UDim2.new(0.087, 0, -0.015, 0);
timeLabel.Size = UDim2.new(0.07, 0, 0.04, 0);
timeLabel.Font = Enum.Font.Nunito;
timeLabel.TextColor3 = Color3.fromRGB(250, 250, 250);
timeLabel.TextScaled = true;
local function updateTime()
timeLabel.Text = getTime();
end
local function onInputBegan(input, gameProcessed)
if (input.KeyCode == timeToggle) and (not gameProcessed) then
sGUI.Enabled = not sGUI.Enabled;
end
end
--: Listeners
fixedLighting = game:GetService("RunService").RenderStepped:Connect(betterLighting);
Time = game:GetService("RunService").RenderStepped:Connect(updateTime);
UIS.InputBegan:Connect(onInputBegan);