2016
2016
2016
-- https://v3rmillion.net/showthread.php?tid=1162657
-- Credits to TheInvisible (V3rmillion)
--Script utils
oldrequire = require
getgenv().bakrequire = require
cache = {}
function IsCached(Inst)
for i,v in next, cache do
if v[1] == Inst then
return true, v[2]
end
end
return false
end
getgenv().require = function(inst)
CachedStatus, Result = IsCached(inst)
if CachedStatus == false and Result == nil then
result = loadstring(inst.Source)()
table.insert(cache, {inst, result})
return result
else
if Result then
return Result
end
end
end
getgenv().LoadLibrary = function(str)
return loadstring(game:GetObjects("rbxassetid://9133787982")[1][str].Source)()
end
ExistAndDelete("RobloxGui")
ExistAndDelete("TeleportGui")
ExistAndDelete("RobloxPromptGui")
ExistAndDelete("RobloxLoadingGui")
ExistAndDelete("PlayerList")
ExistAndDelete("RobloxNetworkPauseNotification")
ExistAndDelete("PurchasePrompt")
ExistAndDelete("HeadsetDisconnectedDialog")
ExistAndDelete("ThemeProvider")
ExistAndDelete("BubbleChat")
--Chat handler (soo people can see your messages) (YOU CAN EDIT THIS IF THE GAME
YOUR PLAYING HAVE A CUSTOM CHAT)
game.Players.LocalPlayer.Chatted:Connect(function(msg)
if
game:GetService("ReplicatedStorage"):FindFirstChild("DefaultChatSystemChatEvents")
~= nil then
if
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents:FindFirstChild("Sa
yMessageRequest") ~= nil then
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents:FindFirstChild("Sa
yMessageRequest"):FireServer(msg, "All")
end
end
end)
task.spawn(function()
while true do
task.wait(.1)
for i,v in pairs(game.Players:GetChildren()) do
if v.Character ~= nil then
if v.Character:FindFirstChild("Humanoid") then
sethiddenproperty(v.Character.Humanoid, "HealthDisplayType",
Enum.HumanoidHealthDisplayType.AlwaysOn)
end
end
end
end
end)
--Funny gui
local RobloxGui = game:GetObjects("rbxassetid://9139773381")[1]
RobloxGui.Parent = game:GetService("CoreGui")
-- Constants
local PLACEID = game.PlaceId
local COLORS = {
BLACK = Color3.new(0, 0, 0),
BACKGROUND_COLOR = Color3.new(45/255, 45/255, 45/255),
WHITE = Color3.new(1, 1, 1),
ERROR = Color3.new(253/255,68/255,72/255)
}
return game.Workspace.CurrentCamera.ViewportSize
end
--
-- Variables
local GameAssetInfo -- loaded by InfoProvider:LoadAssets()
local currScreenGui, renderSteppedConnection = nil, nil
local destroyingBackground, destroyedLoadingGui, hasReplicatedFirstElements =
false, false, false
local backgroundImageTransparency = 0
local isMobile = (UIS.TouchEnabled == true and UIS.MouseEnabled == false and
getViewportSize().Y <= 500)
local isTenFootInterface = guiService:IsTenFootInterface()
local platform = UIS:GetPlatform()
--
-- Utility functions
local create = function(className, defaultParent)
return function(propertyList)
local object = Instance.new(className)
local parent = nil
for index, value in next, propertyList do
if type(index) == 'string' then
if index == 'Parent' then
parent = value
else
object[index] = value
end
else
if type(value) == 'function' then
value(object)
elseif type(value) == 'userdata' then
value.Parent = object
end
end
end
if parent then
object.Parent = parent
end
return object
end
end
--
-- Create objects
local MainGui = {}
local InfoProvider = {}
function ExtractGeneratedUsername(gameName)
local tempUsername = string.match(gameName, "^([0-9a-fA-F]+)'s Place$")
if tempUsername and #tempUsername == 32 then
return tempUsername
end
end
-- Fix places that have been made with incorrect temporary usernames
function GetFilteredGameName(gameName, creatorName)
if gameName and type(gameName) == 'string' then
local tempUsername = ExtractGeneratedUsername(gameName)
if tempUsername then
local newGameName = string.gsub(gameName, tempUsername, creatorName, 1)
if newGameName then
return newGameName
end
end
end
return gameName
end
function InfoProvider:GetGameName()
if GameAssetInfo ~= nil then
if IsConvertMyPlaceNameInXboxAppEnabled() then
return GetFilteredGameName(GameAssetInfo.Name, self:GetCreatorName())
else
return GameAssetInfo.Name
end
else
return ''
end
end
function InfoProvider:GetCreatorName()
if GameAssetInfo ~= nil then
return GameAssetInfo.Creator.Name
else
return ''
end
end
function InfoProvider:LoadAssets()
task.spawn(function()
if PLACEID <= 0 then
while game.PlaceId <= 0 do
wait()
end
PLACEID = game.PlaceId
end
function MainGui:tileBackgroundTexture(frameToFill)
if not frameToFill then return end
frameToFill:ClearAllChildren()
if backgroundImageTransparency < 1 then
local backgroundTextureSize = Vector2.new(512, 512)
for i = 0, math.ceil(frameToFill.AbsoluteSize.X/backgroundTextureSize.X) do
for j = 0, math.ceil(frameToFill.AbsoluteSize.Y/backgroundTextureSize.Y) do
create 'ImageLabel' {
Name = 'BackgroundTextureImage',
BackgroundTransparency = 1,
ImageTransparency = backgroundImageTransparency,
Image = 'rbxasset://textures/loading/darkLoadingTexture.png',
Position = UDim2.new(0, i*backgroundTextureSize.X, 0,
j*backgroundTextureSize.Y),
Size = UDim2.new(0, backgroundTextureSize.X, 0, backgroundTextureSize.Y),
ZIndex = 1,
Parent = frameToFill
}
end
end
end
end
if platformService then
if not game:GetService("ReplicatedFirst"):IsFinishedReplicating() then
local seenBButtonBegin = false
ContextActionService:BindCoreAction("CancelGameLoad",
function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
seenBButtonBegin = true
elseif inputState == Enum.UserInputState.End and seenBButtonBegin then
cancelLabel:Destroy()
cancelText.Text = "Canceling..."
cancelText.Position = UDim2.new(1, -32, 0, 64)
ContextActionService:UnbindCoreAction('CancelGameLoad')
platformService:RequestGameShutdown()
end
end,
false,
Enum.KeyCode.ButtonB)
end
end
--
-- Declare member functions
function MainGui:GenerateMain()
local screenGui = create 'ScreenGui' {
Name = 'RobloxLoadingGui'
}
--
-- create descendant frames
local mainBackgroundContainer = create 'Frame' {
Name = 'BlackFrame',
BackgroundColor3 = COLORS.BACKGROUND_COLOR,
BackgroundTransparency = 0,
Size = UDim2.new(1, 0, 1, 0),
Position = UDim2.new(0, 0, 0, 0),
Active = true,
Parent = screenGui,
}
if isTenFootInterface then
local byLabel = create'TextLabel' {
Name = "ByLabel",
BackgroundTransparency = 1,
Size = UDim2.new(0, 36, 0, 30),
Position = UDim2.new(0, 0, 0, 80),
Font = Enum.Font.SourceSans,
FontSize = Enum.FontSize.Size36,
TextScaled = true,
TextColor3 = COLORS.WHITE,
TextStrokeTransparency = 0,
Text = "By",
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
ZIndex = 2,
Visible = false,
Parent = infoFrame,
}
local creatorIcon = create'ImageLabel' {
Name = "CreatorIcon",
BackgroundTransparency = 1,
Size = UDim2.new(0, 30, 0, 30),
Position = UDim2.new(0, 38, 0, 80),
ImageTransparency = 0,
Image = 'rbxasset://textures/ui/Shell/Icons/RobloxIcon32.png',
ZIndex = 2,
Visible = false,
Parent = infoFrame,
}
end
---------------------------------------------------------
-- Main Script (show something now + setup connections)
renderSteppedConnection =
game:GetService("RunService").RenderStepped:connect(function()
if not currScreenGui then return end
if not currScreenGui:FindFirstChild("BlackFrame") then return end
if setVerb then
setVerb = false
end
if currScreenGui.BlackFrame:FindFirstChild("BackgroundTextureFrame") and
currScreenGui.BlackFrame.BackgroundTextureFrame.AbsoluteSize ~= lastAbsoluteSize
then
lastAbsoluteSize = currScreenGui.BlackFrame.BackgroundTextureFrame.AbsoluteSize
MainGui:tileBackgroundTexture(currScreenGui.BlackFrame.BackgroundTextureFrame)
end
currScreenGui.BlackFrame.GraphicsFrame.LoadingImage.Rotation =
currScreenGui.BlackFrame.GraphicsFrame.LoadingImage.Rotation + turnAmount
task.spawn(function()
local RobloxGui = game:GetService("CoreGui"):WaitForChild("RobloxGui")
local guiInsetChangedEvent = Instance.new("BindableEvent")
guiInsetChangedEvent.Name = "GuiInsetChanged"
guiInsetChangedEvent.Parent = RobloxGui
guiInsetChangedEvent.Event:connect(function(x1, y1, x2, y2)
if currScreenGui and currScreenGui:FindFirstChild("BlackFrame") then
currScreenGui.BlackFrame.Position = UDim2.new(0, -x1, 0, -y1)
currScreenGui.BlackFrame.Size = UDim2.new(1, x1 + x2, 1, y1 + y2)
end
end)
end)
guiService.ErrorMessageChanged:connect(function()
if guiService:GetErrorMessage() ~= '' then
if isTenFootInterface then
currScreenGui.ErrorFrame.Size = UDim2.new(1, 0, 0, 144)
currScreenGui.ErrorFrame.Position = UDim2.new(0, 0, 0, 0)
currScreenGui.ErrorFrame.BackgroundColor3 = COLORS.BLACK
currScreenGui.ErrorFrame.BackgroundTransparency = 0.5
currScreenGui.ErrorFrame.ErrorText.FontSize = Enum.FontSize.Size36
currScreenGui.ErrorFrame.ErrorText.Position = UDim2.new(.3, 0, 0, 0)
currScreenGui.ErrorFrame.ErrorText.Size = UDim2.new(.4, 0, 0, 144)
if errorImage == nil then
errorImage = Instance.new("ImageLabel")
errorImage.Image = "rbxasset://textures/ui/ErrorIconSmall.png"
errorImage.Size = UDim2.new(0, 96, 0, 79)
errorImage.Position = UDim2.new(0.228125, 0, 0, 32)
errorImage.ZIndex = 9
errorImage.BackgroundTransparency = 1
errorImage.Parent = currScreenGui.ErrorFrame
end
-- we show a B button to kill game data model on console
if not isTenFootInterface then
if leaveGameButton == nil then
local RobloxGui = game:GetService("CoreGui"):WaitForChild("RobloxGui")
local utility = require(RobloxGui.Modules.Settings.Utility)
local textLabel = nil
leaveGameButton, leaveGameTextLabel = utility:MakeStyledButton("LeaveGame",
"Leave", UDim2.new(0, 288, 0, 78))
leaveGameButton.NextSelectionDown = leaveGameButton
leaveGameButton.NextSelectionLeft = leaveGameButton
leaveGameButton.NextSelectionRight = leaveGameButton
leaveGameButton.NextSelectionUp = leaveGameButton
leaveGameButton.ZIndex = 9
leaveGameButton.Position = UDim2.new(0.771875, 0, 0, 37)
leaveGameButton.Parent = currScreenGui.ErrorFrame
leaveGameTextLabel.FontSize = Enum.FontSize.Size36
leaveGameTextLabel.ZIndex = 10
game:GetService("GuiService").SelectedCoreObject = leaveGameButton
else
game:GetService("GuiService").SelectedCoreObject = leaveGameButton
end
end
end
currScreenGui.ErrorFrame.ErrorText.Text = guiService:GetErrorMessage()
currScreenGui.ErrorFrame.Visible = true
local blackFrame = currScreenGui:FindFirstChild('BlackFrame')
if blackFrame then
blackFrame.CloseButton.ImageTransparency = 0
blackFrame.CloseButton.Active = true
end
else
currScreenGui.ErrorFrame.Visible = false
end
end)
guiService.UiMessageChanged:connect(function(type, newMessage)
if type == Enum.UiMessageType.UiMessageInfo then
local blackFrame = currScreenGui and currScreenGui:FindFirstChild('BlackFrame')
if blackFrame then
blackFrame.UiMessageFrame.UiMessage.Text = newMessage
if newMessage ~= '' then
blackFrame.UiMessageFrame.Visible = true
else
blackFrame.UiMessageFrame.Visible = false
end
end
end
end)
function stopListeningToRenderingStep()
if renderSteppedConnection then
renderSteppedConnection:disconnect()
renderSteppedConnection = nil
end
end
function fadeAndDestroyBlackFrame(blackFrame)
if destroyingBackground then return end
destroyingBackground = true
task.spawn(function()
local infoFrame = blackFrame:FindFirstChild("InfoFrame")
local graphicsFrame = blackFrame:FindFirstChild("GraphicsFrame")
lastUpdateTime = newTime
end
wait()
end
if blackFrame ~= nil then
stopListeningToRenderingStep()
blackFrame:Destroy()
end
end)
end
function destroyLoadingElements(instant)
if not currScreenGui then return end
if destroyedLoadingGui then return end
destroyedLoadingGui = true
function handleFinishedReplicating()
hasReplicatedFirstElements = (#game:GetService("ReplicatedFirst"):GetChildren()
> 0)
game:GetService("ReplicatedFirst").FinishedReplicating:connect(handleFinishedReplic
ating)
if game:GetService("ReplicatedFirst"):IsFinishedReplicating() then
handleFinishedReplicating()
end
game:GetService("ReplicatedFirst").RemoveDefaultLoadingGuiSignal:connect(handleRemo
veDefaultLoadingGui)
if game:GetService("ReplicatedFirst"):IsDefaultLoadingGuiRemoved() then
handleRemoveDefaultLoadingGui()
end
local UserInputServiceChangedConn;
local function onUserInputServiceChanged(prop)
if prop == 'VREnabled' then
local UseVr = false
pcall(function() UseVr = UIS.VREnabled end)
if UseVr then
if UserInputServiceChangedConn then
UserInputServiceChangedConn:disconnect()
UserInputServiceChangedConn = nil
end
handleRemoveDefaultLoadingGui(true)
require(RobloxGui.Modules.LoadingScreen3D)
end
end
end
UserInputServiceChangedConn = UIS.Changed:connect(onUserInputServiceChanged)
onUserInputServiceChanged('VREnabled')
end)
task.spawn(function()
-- Creates all neccessary scripts for the gui on initial load, everything except
build tools
-- Created by Ben T. 10/29/10
-- Please note that these are loaded in a specific order to diminish
errors/perceived load time by user
]==]
loadstring(Inject..tostring(RobloxGui.CoreScriptSyn[str].Source))()
end
-- TopBar
task.spawn(function()
AddCoreScriptLocal("Topbar")
end)
-- SettingsScript
local luaControlsSuccess, luaControlsFlagValue = pcall(function() return
settings():GetFFlag("UseLuaCameraAndControl") end)
-- Chat script
task.spawn(function() safeRequire(RobloxGui.Modules.ChatSelector) end)
task.spawn(function() safeRequire(RobloxGui.Modules.PlayerlistModule) end)
task.spawn(function()
AddCoreScriptLocal("BubbleChat")
end)
-- Purchase Prompt Script (run both versions, they will check the relevant flag)
task.spawn(function()
AddCoreScriptLocal("PurchasePromptScript2")
end)
task.spawn(function()
AddCoreScriptLocal("PurchasePromptScript3")
end)
-- Backpack!
task.spawn(function() safeRequire(RobloxGui.Modules.BackpackScript) end)
task.spawn(function()
AddCoreScriptLocal("VehicleHud")
end)
task.spawn(function()
AddCoreScriptLocal("GamepadMenu")
end)
if touchEnabled then -- touch devices don't use same control frame
-- only used for touch device button generation
task.spawn(function()
AddCoreScriptLocal("ContextActionTouch")
end)
RobloxGui:WaitForChild("ControlFrame")
RobloxGui.ControlFrame:WaitForChild("BottomLeftControl")
RobloxGui.ControlFrame.BottomLeftControl.Visible = false
end
do
local UserInputService = game:GetService('UserInputService')
local function tryRequireVRKeyboard()
if UserInputService.VREnabled then
return safeRequire(RobloxGui.Modules.VR.VirtualKeyboard)
end
return nil
end
if not tryRequireVRKeyboard() then
UserInputService.Changed:connect(function(prop)
if prop == "VREnabled" then
tryRequireVRKeyboard()
end
end)
end
end