Newtrat

[ROBLOX] StarterScript.lua

Apr 15th, 2016
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1. -- Creates all neccessary scripts for the gui on initial load, everything except build tools
  2. -- Created by Ben T. 10/29/10
  3. -- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
  4.  
  5. local scriptContext = game:GetService("ScriptContext")
  6. local touchEnabled = game:GetService("UserInputService").TouchEnabled
  7.  
  8. local RobloxGui = game:GetService("CoreGui"):WaitForChild("RobloxGui")
  9.  
  10. local soundFolder = Instance.new("Folder")
  11. soundFolder.Name = "Sounds"
  12. soundFolder.Parent = RobloxGui
  13.  
  14. -- TopBar
  15. local topbarSuccess, topbarFlagValue = pcall(function() return settings():GetFFlag("UseInGameTopBar") end)
  16. local useTopBar = (topbarSuccess and topbarFlagValue == true)
  17. if useTopBar then
  18.     scriptContext:AddCoreScriptLocal("CoreScripts/Topbar", RobloxGui)
  19. end
  20.  
  21. -- SettingsScript
  22. local luaControlsSuccess, luaControlsFlagValue = pcall(function() return settings():GetFFlag("UseLuaCameraAndControl") end)
  23.  
  24. -- MainBotChatScript (the Lua part of Dialogs)
  25. scriptContext:AddCoreScriptLocal("CoreScripts/MainBotChatScript2", RobloxGui)
  26.  
  27. -- Developer Console Script
  28. scriptContext:AddCoreScriptLocal("CoreScripts/DeveloperConsole", RobloxGui)
  29.  
  30. -- In-game notifications script
  31. scriptContext:AddCoreScriptLocal("CoreScripts/NotificationScript2", RobloxGui)
  32.  
  33. -- Chat script
  34. if useTopBar then
  35.     spawn(function() require(RobloxGui.Modules.Chat) end)
  36.     spawn(function() require(RobloxGui.Modules.PlayerlistModule) end)
  37. end
  38.  
  39. scriptContext:AddCoreScriptLocal("CoreScripts/BubbleChat", RobloxGui)
  40.  
  41. -- Purchase Prompt Script
  42. scriptContext:AddCoreScriptLocal("CoreScripts/PurchasePromptScript2", RobloxGui)
  43.  
  44. -- Health Script
  45. if not useTopBar then
  46.     scriptContext:AddCoreScriptLocal("CoreScripts/HealthScript", RobloxGui)
  47. end
  48.  
  49. do -- Backpack!
  50.     spawn(function() require(RobloxGui.Modules.BackpackScript) end)
  51. end
  52.  
  53. if useTopBar then
  54.     scriptContext:AddCoreScriptLocal("CoreScripts/VehicleHud", RobloxGui)
  55. end
  56.  
  57. scriptContext:AddCoreScriptLocal("CoreScripts/GamepadMenu", RobloxGui)
  58.  
  59. if touchEnabled then -- touch devices don't use same control frame
  60.     -- only used for touch device button generation
  61.     scriptContext:AddCoreScriptLocal("CoreScripts/ContextActionTouch", RobloxGui)
  62.  
  63.     RobloxGui:WaitForChild("ControlFrame")
  64.     RobloxGui.ControlFrame:WaitForChild("BottomLeftControl")
  65.     RobloxGui.ControlFrame.BottomLeftControl.Visible = false
  66. end
Advertisement
Add Comment
Please, Sign In to add comment