159 lines
5.3 KiB
Lua
159 lines
5.3 KiB
Lua
require(game.ReplicatedFirst.ReadyModule)
|
|
local optionFrame = script.Parent:WaitForChild("OptionFrame")
|
|
local options = optionFrame:WaitForChild("Options")
|
|
function registerToggle(name,callback)
|
|
local button = options:WaitForChild(name)
|
|
local value = button.TextButton.Text == "On"
|
|
button.TextButton.MouseButton1Click:Connect(function()
|
|
value = not value
|
|
local new = "On"
|
|
if not value then
|
|
new = "Off"
|
|
end
|
|
button.TextButton.Text = new
|
|
callback(value)
|
|
_G.Events.Notification:Fire(name,new)
|
|
end)
|
|
end
|
|
local function registerSlider(name,callback)
|
|
local slider = options:WaitForChild(name)
|
|
local drag = slider:WaitForChild("Slider"):WaitForChild("Drag")
|
|
local etch = slider:WaitForChild("Slider"):WaitForChild("Etch")
|
|
local hold
|
|
local position
|
|
local event
|
|
local function changed(object)
|
|
if hold then
|
|
local delta = (object.Position - hold).X
|
|
local final = math.clamp((delta/(etch.AbsoluteSize.X))+position,0,1)
|
|
drag.Position = UDim2.new(final,0,0,0)
|
|
callback(final)
|
|
else
|
|
event:Disconnect()
|
|
end
|
|
end
|
|
drag.InputBegan:Connect(function(object)
|
|
if object.UserInputType == Enum.UserInputType.MouseButton1 or object.UserInputType == Enum.UserInputType.Touch then
|
|
hold = object.Position
|
|
position = drag.Position.X.Scale
|
|
event = _G.Input.InputChanged:Connect(changed)
|
|
end
|
|
end)
|
|
drag.InputEnded:Connect(function(object)
|
|
if object.UserInputType == Enum.UserInputType.MouseButton1 or object.UserInputType == Enum.UserInputType.Touch then
|
|
hold = nil
|
|
position = nil
|
|
end
|
|
end)
|
|
end
|
|
local collaborateButton = options:WaitForChild("CollaborateButton")
|
|
collaborateButton.MouseButton1Click:Connect(function()
|
|
_G.Remotes.Collaborate:InvokeServer(nil,nil)
|
|
end)
|
|
registerSlider("Air",function(value)
|
|
game.Workspace.CompensateDensity.Value = value * 2
|
|
end)
|
|
registerToggle("Destruction",function(value)
|
|
game.Workspace.Destruction.Value = value
|
|
end)
|
|
registerToggle("Combat",function(value)
|
|
game.Workspace.Combat.Value = value
|
|
if value then
|
|
_G.Remotes.Combat:InvokeServer()
|
|
end
|
|
end)
|
|
registerToggle("Debug",function(value)
|
|
game.Workspace.DebugWings.Value = value
|
|
end)
|
|
registerToggle("Stats",function(value)
|
|
_G.StatisticsFrame.Visible = value
|
|
end)
|
|
registerSlider("Dead",function(value)
|
|
local val = value > 0.5
|
|
game.Lighting.ColorCorrection.Enabled = val
|
|
game.Lighting.ColorGrading.Enabled = val
|
|
end)
|
|
local defaultDensity = 0.262
|
|
local defaultBlur = 24
|
|
local changeFog = function(value)
|
|
game.Lighting.Atmosphere.Density = defaultDensity*value
|
|
game.Lighting.Blur.Size = defaultBlur*value
|
|
end
|
|
local changeTime = function(value)
|
|
game.Lighting.Time.Value = value * 24
|
|
end
|
|
registerSlider("Fog",changeFog)
|
|
registerSlider("Time",changeTime)
|
|
--if _G.Statistics.fog_enabled then changeFog() options:WaitForChild("Fog").Text = "Off" end
|
|
local minimized = true
|
|
local toggle = _G:WaitFor("OptionsButton")
|
|
local extended = optionFrame.Position
|
|
local retracted = UDim2.new(UDim.new(0,-optionFrame.AbsoluteSize.X),extended.Y)
|
|
optionFrame.Position = retracted
|
|
optionFrame.Visible = true
|
|
local function toggleMenu()
|
|
print("toggle")
|
|
minimized = not minimized
|
|
optionFrame.Visible = not minimized
|
|
--[[local new
|
|
if minimized then
|
|
new = retracted
|
|
else
|
|
new = extended
|
|
end
|
|
optionFrame:TweenPosition(new,Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,0.4,true)]]
|
|
end
|
|
toggle.Activated:Connect(toggleMenu)
|
|
local input = game:GetService("UserInputService")
|
|
input.InputBegan:Connect(function(input,irrelevant)
|
|
if not irrelevant and input.KeyCode == Enum.KeyCode.Backquote then
|
|
if input:IsModifierKeyDown(Enum.ModifierKey.Shift) then
|
|
minimized = true
|
|
optionFrame.Visible = false
|
|
optionFrame.Options.Command.CommandBox:ReleaseFocus()
|
|
else
|
|
minimized = false
|
|
optionFrame.Visible = true
|
|
wait() optionFrame.Options.Command.CommandBox:CaptureFocus()
|
|
end
|
|
end
|
|
end)
|
|
|
|
--game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
|
|
local messageFrame = script.Parent:WaitForChild("MessageFrame")
|
|
local messageBox = messageFrame:WaitForChild("TextBox")
|
|
local messageContainer = messageFrame:WaitForChild("ScrollingFrame")
|
|
_G.Remotes.Chat.OnClientEvent:Connect(function(title,content,color)
|
|
local message = messageContainer.Template.Message:Clone()
|
|
message.Parent = messageContainer
|
|
message.Title.Text = title
|
|
message.Content.Text = content
|
|
message.Title.TextColor3 = color
|
|
message.Visible = true
|
|
messageContainer.CanvasPosition = Vector2.new(0, messageContainer.CanvasSize.Y.Offset - messageContainer.AbsoluteSize.Y)
|
|
end)
|
|
_G.Input.InputBegan:Connect(function(input,irrelevant)
|
|
if not irrelevant and input.KeyCode == Enum.KeyCode.Slash then
|
|
messageBox:CaptureFocus()
|
|
end
|
|
end)
|
|
_G:WaitFor("ChatHideButton").Activated:Connect(function()
|
|
messageFrame.Visible = not messageFrame.Visible
|
|
end)
|
|
messageBox.FocusLost:Connect(function(enterPressed)
|
|
if enterPressed then
|
|
local message = messageBox.Text
|
|
:gsub("\n","<br/>")
|
|
:gsub("<br>","<br/>")
|
|
:gsub("<big>(.-)</big>","<font size=\"28\">%1</font>")
|
|
:gsub("<small>(.-)</small>","<font size=\"10\">%1</font>")
|
|
:gsub("<green>(.-)</green>","<font color=\"#00FF00\">%1</font>")
|
|
:gsub("<red>(.-)</red>","<font color=\"#FF0000\">%1</font>")
|
|
:gsub("<trans.->(.-)</trans.->","<font transparency=\"0.5\">%1</font>")
|
|
:gsub("_(.-)_","<i>%1</i>")
|
|
:gsub("*(.-)*","<b>%1</b>")
|
|
if #message == 0 then return end
|
|
_G.Remotes.Chat:FireServer(message)
|
|
messageBox.Text = ""
|
|
end
|
|
end) |