Advertisement
Upscalefanatic3

Mod Menu For FPS or TPS Games Script

Jan 24th, 2018
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.16 KB | None | 0 0
  1. math.randomseed(tick());
  2.  
  3. local Player = game:GetService("Players").LocalPlayer;
  4.  
  5. local GuiParent = (
  6. game:GetService("RunService"):IsStudio() and Player:WaitForChild("PlayerGui")
  7. );
  8.  
  9. pcall(function()
  10. GuiParent = (
  11. ((GuiParent ~= nil) and GuiParent) or game:GetService("CoreGui")
  12. );
  13. end);
  14.  
  15. local GuiParent = ((not GuiParent) and Player:WaitForChild("PlayerGui") or GuiParent);
  16.  
  17. local RbxMods = Instance.new("ScreenGui", GuiParent);
  18. RbxMods.Name = "RbxMods";
  19. RbxMods.ResetOnSpawn = false;
  20.  
  21. local Background = Instance.new("Frame", RbxMods);
  22. Background.Name = "Background";
  23. Background.ZIndex = 10;
  24. Background.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  25. Background.BorderColor3 = Background.BackgroundColor3;
  26. Background.BorderSizePixel = 0;
  27. Background.Position = UDim2.new(0, 10, 0, 10);
  28. Background.Size = UDim2.new(0, 220, 0, 20);
  29.  
  30. local MenuSettings = {
  31. Defaults = {};
  32. CurrentStatuses = {};
  33. VisibleStatuses = {};
  34. Statuses = {};
  35. CurrentMenuAppendPosition = 22;
  36. FeatureLock = nil;
  37. };
  38.  
  39. local FeatureChangeCallbacks = {};
  40.  
  41. local function CycleSetting(Direction, Setting)
  42. if ((not MenuSettings.FeatureLock) or (Setting == "Features Lock")) then
  43. local CurrentPosition;
  44. local OldStatus = MenuSettings.CurrentStatuses[Setting];
  45. for Key, Value in next, MenuSettings.Statuses[Setting] do
  46. if (Value == OldStatus) then
  47. CurrentPosition = Key;
  48. end;
  49. end;
  50. local Key = CurrentPosition;
  51. if (Direction == "Forward") then
  52. Key = (Key + 1);
  53. elseif (Direction == "Backward") then
  54. Key = (Key - 1);
  55. end;
  56. if (Key > #MenuSettings.Statuses[Setting]) then
  57. Key = 1;
  58. elseif (Key < 1) then
  59. Key = #MenuSettings.Statuses[Setting];
  60. end;
  61. MenuSettings.CurrentStatuses[Setting] = MenuSettings.Statuses[Setting][Key];
  62. if (Setting == "Features Lock") then
  63. MenuSettings.FeatureLock = (not MenuSettings.FeatureLock);
  64. end;
  65. end;
  66. end;
  67.  
  68. local function UpdateFeatureStatusCallback(StatusLabel, StatusSymbol, Data)
  69. local Text = MenuSettings.CurrentStatuses[Data.Name];
  70. local Prefix = (MenuSettings.Defaults[Text] and "" or "[");
  71. local Suffix = (MenuSettings.Defaults[Text] and "" or "]");
  72. if (((Prefix == "") and (Suffix == "")) and (not Data.CanBeDisabled)) then
  73. Prefix = "[";
  74. Suffix = "]";
  75. end;
  76. StatusLabel.Text = (Prefix..Text..Suffix);
  77. local Enabled = (
  78. not (MenuSettings.CurrentStatuses[Data.Name] == Data.Statuses[1])
  79. );
  80. StatusSymbol.BackgroundColor3 = (
  81. (Data.CanBeDisabled and (
  82. (Enabled and Color3.new(0, 1, 0)) or Color3.new(1, 0, 0)
  83. )
  84. ) or
  85. Color3.new(1, 0.7, 0)
  86. );
  87. if FeatureChangeCallbacks[Data.Name] then
  88. pcall(FeatureChangeCallbacks[Data.Name]);
  89. end;
  90. end;
  91.  
  92. local function AddMenuItem(Type, Data)
  93. if (Type == "Category") then
  94. MenuSettings.VisibleStatuses[Data.Name] = Data.OpenStatus;
  95. local Category = Instance.new("Frame", Background);
  96. Category.Name = ("Category: "..Data.Name);
  97. Category.ZIndex = 10;
  98. Category.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  99. Category.BorderColor3 = Category.BackgroundColor3;
  100. Category.BorderSizePixel = 0;
  101. Category.BackgroundTransparency = 1;
  102. Category.Position = UDim2.new(
  103. 0, 0, 0,
  104. MenuSettings.CurrentMenuAppendPosition
  105. );
  106. Category.Size = UDim2.new(1, 0, 0, 20);
  107. local CategoryLabel = Instance.new("TextButton", Category);
  108. CategoryLabel.AutoButtonColor = false;
  109. CategoryLabel.Name = "CategoryLabel";
  110. CategoryLabel.ZIndex = 10;
  111. CategoryLabel.BackgroundColor3 = Color3.fromRGB(80, 80, 80);
  112. CategoryLabel.BorderColor3 = CategoryLabel.BackgroundColor3;
  113. CategoryLabel.BorderSizePixel = 0;
  114. CategoryLabel.Size = UDim2.new(1, 0, 0, 20);
  115. CategoryLabel.Text = (
  116. Data.Name.." ("..(
  117. (Data.OpenStatus and "Close") or ((not Data.OpenStatus) and "Open")
  118. )..")"
  119. );
  120. CategoryLabel.Font = Enum.Font.ArialBold;
  121. CategoryLabel.TextSize = 15;
  122. CategoryLabel.TextColor3 = Color3.new(0.85, 0.85, 0);
  123. CategoryLabel.TextStrokeColor3 = CategoryLabel.TextColor3;
  124. Background.Size = (Background.Size + UDim2.new(0, 0, 0, 22));
  125. MenuSettings.CurrentMenuAppendPosition = (
  126. MenuSettings.CurrentMenuAppendPosition + 22
  127. );
  128. elseif (Type == "Feature") then
  129. MenuSettings.Statuses[Data.Name] = Data.Statuses;
  130. MenuSettings.Defaults[Data.Statuses[1]] = true;
  131. if (not MenuSettings.CurrentStatuses[Data.Name]) then
  132. MenuSettings.CurrentStatuses[Data.Name] = Data.Statuses[1];
  133. end;
  134. local FeatureHolder = Instance.new(
  135. "Frame",
  136. Background:FindFirstChild("Category: "..Data.Category)
  137. );
  138. FeatureHolder.Name = ("Feature: "..Data.Name);
  139. FeatureHolder.ZIndex = 10;
  140. FeatureHolder.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  141. FeatureHolder.BorderColor3 = FeatureHolder.BackgroundColor3;
  142. FeatureHolder.BorderSizePixel = 0;
  143. FeatureHolder.BackgroundTransparency = 1;
  144. FeatureHolder.Position = UDim2.new(0, 0, 0, 20);
  145. FeatureHolder.Size = UDim2.new(1, 0, 0, 20);
  146. local Divider = Instance.new("Frame", FeatureHolder);
  147. Divider.Name = "Divider";
  148. Divider.ZIndex = 10;
  149. Divider.BackgroundColor3 = Color3.fromRGB(200, 200, 200);
  150. Divider.BorderColor3 = Divider.BackgroundColor3;
  151. Divider.BorderSizePixel = 0;
  152. Divider.Size = UDim2.new(0, 2, 1, 2);
  153. Divider.Position = UDim2.new(
  154. 0, 19, 0,
  155. (1 + (22 * (Data.FeaturePositionFactor - 1)))
  156. );
  157. local StatusSymbol = Instance.new("Frame", FeatureHolder);
  158. StatusSymbol.Name = "StatusSymbol";
  159. StatusSymbol.ZIndex = 10;
  160. StatusSymbol.BorderColor3 = Background.BackgroundColor3;
  161. StatusSymbol.BorderSizePixel = 0;
  162. StatusSymbol.Size = UDim2.new(0, 15, 0, 14);
  163. StatusSymbol.Position = UDim2.new(
  164. 0, 2, 0.5,
  165. (-6 + (22 * (Data.FeaturePositionFactor - 1)))
  166. );
  167. local FeatureLabel = Instance.new("TextLabel", FeatureHolder);
  168. FeatureLabel.Name = "FeatureLabel";
  169. FeatureLabel.ZIndex = 10;
  170. FeatureLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  171. FeatureLabel.BorderColor3 = FeatureLabel.BackgroundColor3;
  172. FeatureLabel.BorderSizePixel = 0;
  173. FeatureLabel.BackgroundTransparency = 1;
  174. FeatureLabel.Size = UDim2.new(0, 1, 1, 0);
  175. FeatureLabel.Position = (Divider.Position + UDim2.new(0, 3, 0, 0));
  176. FeatureLabel.Text = Data.Name;
  177. FeatureLabel.Font = Enum.Font.ArialBold;
  178. FeatureLabel.TextSize = 14;
  179. FeatureLabel.TextColor3 = Color3.new(1, 1, 1);
  180. FeatureLabel.TextStrokeColor3 = FeatureLabel.TextColor3;
  181. FeatureLabel.TextXAlignment = Enum.TextXAlignment.Left;
  182. local StatusLabel = Instance.new("TextButton", FeatureHolder);
  183. StatusLabel.AutoButtonColor = false;
  184. StatusLabel.Name = "StatusLabel";
  185. StatusLabel.ZIndex = 10;
  186. StatusLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
  187. StatusLabel.BorderColor3 = StatusLabel.BackgroundColor3;
  188. StatusLabel.BorderSizePixel = 0;
  189. StatusLabel.BackgroundTransparency = 1;
  190. StatusLabel.Font = Enum.Font.ArialBold;
  191. StatusLabel.TextSize = 14;
  192. StatusLabel.TextColor3 = Color3.new(1, 1, 1);
  193. StatusLabel.TextStrokeColor3 = StatusLabel.TextColor3;
  194. StatusLabel.TextXAlignment = Enum.TextXAlignment.Right;
  195. StatusLabel.Size = UDim2.new(0, StatusLabel.TextBounds.X, 1, 0);
  196. StatusLabel.Position = UDim2.new(
  197. 1, -(StatusLabel.Size.X.Offset + 1), 0,
  198. (22 * (Data.FeaturePositionFactor - 1))
  199. );
  200. UpdateFeatureStatusCallback(StatusLabel, StatusSymbol, Data);
  201. StatusLabel.MouseButton1Click:Connect(function()
  202. CycleSetting("Forward", Data.Name);
  203. UpdateFeatureStatusCallback(StatusLabel, StatusSymbol, Data);
  204. end);
  205. StatusLabel.MouseButton2Click:Connect(function()
  206. CycleSetting("Backward", Data.Name);
  207. UpdateFeatureStatusCallback(StatusLabel, StatusSymbol, Data);
  208. end);
  209. Background.Size = (Background.Size + UDim2.new(0, 0, 0, 22));
  210. MenuSettings.CurrentMenuAppendPosition = (
  211. MenuSettings.CurrentMenuAppendPosition + 22
  212. );
  213. end;
  214. end;
  215.  
  216. function RenderMenu(
  217. RenderTestDropdown,
  218. RenderMenuSettings
  219. )
  220. Background:ClearAllChildren();
  221. local IsInUse = (
  222. RenderTestDropdown or
  223. RenderMenuSettings
  224. );
  225. Background.Size = UDim2.new(0, 220, 0, (IsInUse and 23 or 20));
  226. local TopLabel = Instance.new("TextLabel", Background);
  227. TopLabel.Name = "TopLabel";
  228. TopLabel.ZIndex = 10;
  229. TopLabel.BackgroundColor3 = Color3.fromRGB(80, 80, 80);
  230. TopLabel.BorderColor3 = TopLabel.BackgroundColor3;
  231. TopLabel.BorderSizePixel = 0;
  232. TopLabel.Size = UDim2.new(1, 0, 0, 20);
  233. TopLabel.Text = "RbxMods [vD] || By: Programmeh";
  234. TopLabel.Font = Enum.Font.ArialBold;
  235. TopLabel.TextSize = 15;
  236. TopLabel.TextColor3 = Color3.new(1, 1, 1);
  237. TopLabel.TextStrokeColor3 = TopLabel.TextColor3;
  238. MenuSettings.CurrentMenuAppendPosition = 22;
  239. AddMenuItem(
  240. "Category",
  241. {
  242. Name = "Test";
  243. OpenStatus = RenderTestDropdown;
  244. }
  245. );
  246. if RenderTestDropdown then
  247. AddMenuItem(
  248. "Feature",
  249. {
  250. Name = "Penis";
  251. CanBeDisabled = true;
  252. Statuses = {
  253. "Tiny";
  254. "Huge";
  255. };
  256. Category = "Test";
  257. FeaturePositionFactor = 1;
  258. }
  259. );
  260. end;
  261. AddMenuItem(
  262. "Category",
  263. {
  264. Name = "Menu";
  265. OpenStatus = RenderMenuSettings;
  266. }
  267. );
  268. if RenderMenuSettings then
  269. AddMenuItem(
  270. "Feature",
  271. {
  272. Name = "Menu Toggle Key";
  273. CanBeDisabled = false;
  274. Statuses = {
  275. "Delete";
  276. "Insert";
  277. };
  278. Category = "Menu";
  279. FeaturePositionFactor = 1;
  280. }
  281. );
  282. AddMenuItem(
  283. "Feature",
  284. {
  285. Name = "Menu Theme";
  286. CanBeDisabled = false;
  287. Statuses = {
  288. "Dark";
  289. "Light";
  290. };
  291. Category = "Menu";
  292. FeaturePositionFactor = 2;
  293. }
  294. );
  295. AddMenuItem(
  296. "Feature",
  297. {
  298. Name = "Features Lock";
  299. CanBeDisabled = true;
  300. Statuses = {
  301. "Disabled";
  302. "Enabled";
  303. };
  304. Category = "Menu";
  305. FeaturePositionFactor = 3
  306. }
  307. );
  308. end;
  309. local Categories = {
  310. "Test";
  311. "Menu";
  312. };
  313. for Key, Value in next, Categories do
  314. Background:FindFirstChild(
  315. "Category: "..Value
  316. ):FindFirstChildOfClass("TextButton").MouseButton1Click:Connect(function()
  317. MenuSettings.VisibleStatuses[Value] = (
  318. not MenuSettings.VisibleStatuses[Value]
  319. );
  320. RenderMenu(
  321. MenuSettings.VisibleStatuses.Test,
  322. MenuSettings.VisibleStatuses.Menu
  323. );
  324. end);
  325. end;
  326. if FeatureChangeCallbacks["Menu Theme"] then
  327. pcall(FeatureChangeCallbacks["Menu Theme"]);
  328. end;
  329. end;
  330.  
  331. RenderMenu(
  332. true,
  333. true
  334. );
  335.  
  336. RenderMenu(
  337. false,
  338. false
  339. );
  340.  
  341. game:GetService("UserInputService").InputBegan:Connect(function(
  342. InputObject,
  343. GameProcessedEvent
  344. )
  345. if (
  346. (not GameProcessedEvent) and
  347. (InputObject.UserInputType == Enum.UserInputType.Keyboard)
  348. ) then
  349. if (
  350. InputObject.KeyCode ==
  351. Enum.KeyCode[MenuSettings.CurrentStatuses["Menu Toggle Key"]]
  352. ) then
  353. Background.Visible = (not Background.Visible);
  354. end;
  355. end;
  356. end);
  357.  
  358. local CachedDarkTheme = {};
  359. local Cached;
  360.  
  361. FeatureChangeCallbacks["Menu Theme"] = function()
  362. local function AttemptToCache()
  363. if (not Cached) then
  364. Cached = true;
  365. for Key, Value in next, Background:GetDescendants() do
  366. local Success = pcall(function()
  367. return Value.TextColor3;
  368. end);
  369. if Success then
  370. CachedDarkTheme[Value.Name] = {
  371. BackgroundColor = Value.BackgroundColor3;
  372. TextColor = Value.TextColor3;
  373. };
  374. if Value.Name:find("Close") then
  375. CachedDarkTheme[
  376. Value.Name:gsub("Close", "Open")
  377. ] = CachedDarkTheme[Value.Name];
  378. elseif Value.Name:find("Open") then
  379. CachedDarkTheme[
  380. Value.Name:gsub("Open", "Close")
  381. ] = CachedDarkTheme[Value.Name];
  382. end;
  383. else
  384. CachedDarkTheme[Value.Name] = {
  385. BackgroundColor = Value.BackgroundColor3;
  386. };
  387. if Value.Name:find("Close") then
  388. CachedDarkTheme[
  389. Value.Name:gsub("Close", "Open")
  390. ] = CachedDarkTheme[Value.Name];
  391. elseif Value.Name:find("Open") then
  392. CachedDarkTheme[
  393. Value.Name:gsub("Open", "Close")
  394. ] = CachedDarkTheme[Value.Name];
  395. end;
  396. end;
  397. end;
  398. end;
  399. end;
  400. local function SetColor(Type, GuiObject, RGBColor3)
  401. if (Type == "Background") then
  402. GuiObject.BackgroundColor3 = RGBColor3;
  403. GuiObject.BorderColor3 = RGBColor3;
  404. elseif (Type == "Text") then
  405. GuiObject.TextColor3 = RGBColor3;
  406. GuiObject.TextStrokeColor3 = RGBColor3;
  407. elseif (Type == "Both") then
  408. GuiObject.BackgroundColor3 = RGBColor3;
  409. GuiObject.BorderColor3 = RGBColor3;
  410. GuiObject.TextColor3 = RGBColor3;
  411. GuiObject.TextStrokeColor3 = RGBColor3;
  412. end
  413. end;
  414. if (MenuSettings.CurrentStatuses["Menu Theme"] == "Dark") then
  415. if CachedDarkTheme.Background then
  416. for Key, Value in next, Background:GetDescendants() do
  417. pcall(SetColor, "Both", Value, CachedDarkTheme[Value.Name]);
  418. end;
  419. end;
  420. local RGB50 = Color3.fromRGB(50, 50, 50);
  421. local RGB80 = Color3.fromRGB(80, 80, 80);
  422. local RGB1 = Color3.new(1, 1, 1);
  423. for Key, Value in next, Background:GetDescendants() do
  424. if Value:IsA("TextButton") then
  425. SetColor("Background", Value, RGB50);
  426. SetColor("Text", Value, RGB1);
  427. if Value.Text:find("%(%w+%)") then
  428. SetColor("Background", Value, RGB80);
  429. SetColor("Text", Value, Color3.new(1, 1, 0));
  430. end;
  431. elseif (Value:IsA("TextLabel") and (Value.Name ~= "TopLabel")) then
  432. SetColor("Background", Value, RGB50);
  433. SetColor("Text", Value, RGB1);
  434. end;
  435. end;
  436. SetColor("Background", Background, RGB50);
  437. SetColor("Background", Background.TopLabel, RGB80);
  438. SetColor("Text", Background.TopLabel, RGB1);
  439. elseif (MenuSettings.CurrentStatuses["Menu Theme"] == "Light") then
  440. AttemptToCache();
  441. local RGB210 = Color3.fromRGB(210, 210, 210);
  442. local RGB1 = Color3.new(1, 1, 1);
  443. local RGB0 = Color3.new(0, 0, 0);
  444. SetColor("Background", Background, RGB210);
  445. SetColor("Background", Background.TopLabel, RGB1);
  446. SetColor("Text", Background.TopLabel, RGB0);
  447. for Key, Value in next, Background:GetDescendants() do
  448. if Value:IsA("TextButton") then
  449. SetColor("Background", Value, RGB210);
  450. SetColor("Text", Value, Color3.new(0, 0, 0));
  451. if Value.Text:find("%(%w+%)") then
  452. SetColor("Background", Value, RGB1);
  453. SetColor("Text", Value, Color3.new(0, 0, 1));
  454. end;
  455. elseif (Value:IsA("TextLabel") and (Value.Name ~= "TopLabel")) then
  456. SetColor("Background", Value, RGB210);
  457. SetColor("Text", Value, RGB0);
  458. end;
  459. end;
  460. end;
  461. end;
  462.  
  463. print("[RbxMods]: Script loaded! Created by: Programmeh@V3rmillion.net");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement