Advertisement
killerbrenden

End Problem?

Mar 5th, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.02 KB | None | 0 0
  1. local toolbar = plugin:CreateToolbar("Stat Creator")
  2.  
  3. local button = toolbar:CreateButton(
  4.     "Create Custom Stat",
  5.     "Create A New Custom Stat Script",
  6.     ""
  7. )
  8.  
  9. button.Click:Connect(function()
  10.     if game:GetService("CoreGui"):FindFirstChild("StatGui") then
  11.         game:GetService("CoreGui"):FindFirstChild("StatGui"):Destroy()
  12.     else
  13.         local statGui = Instance.new("ScreenGui",game:GetService("CoreGui"))
  14.         statGui.Name = "StatGui"
  15.        
  16.         local values = {"BoolValue","IntValue","NumberValue","StringValue"}
  17.        
  18.         --// Visuals
  19.         local imageHolder = Instance.new("ImageLabel",statGui)
  20.         imageHolder.Name = "MainFrame"
  21.         imageHolder.Size = UDim2.new(0.5,0,0.5,0)
  22.         imageHolder.AnchorPoint = Vector2.new(0.5,0.5)
  23.         imageHolder.BackgroundTransparency = 1
  24.         imageHolder.Position = UDim2.new(0.5,0,0.5,0)
  25.         imageHolder.Image = "rbxassetid://3570695787"
  26.         imageHolder.ImageTransparency = 0.5
  27.         imageHolder.ImageColor3 = Color3.fromRGB(10,10,10)
  28.         imageHolder.ScaleType = Enum.ScaleType.Slice
  29.         imageHolder.SliceCenter = Rect.new(100,100,100,100)
  30.         imageHolder.SliceScale = 0.12
  31.        
  32.         local textLabel = Instance.new("TextLabel",imageHolder)
  33.         textLabel.Name = "Title"
  34.         textLabel.BackgroundTransparency = 1
  35.         textLabel.Size = UDim2.new(1,0,0.15,0)
  36.         textLabel.TextScaled = true
  37.         textLabel.TextWrapped = true
  38.         textLabel.TextColor3 = Color3.fromRGB(225,225,225)
  39.         textLabel.Font = Enum.Font.SourceSansLight
  40.         textLabel.Text = "Custom Stat Creator"
  41.        
  42.         local scrollingFrame = Instance.new("ScrollingFrame",imageHolder)
  43.         scrollingFrame.Position = UDim2.new(0,0,0.25,0)
  44.         scrollingFrame.Size = UDim2.new(1,0,0.75,0)
  45.         scrollingFrame.BackgroundTransparency = 1
  46.         scrollingFrame.ScrollBarThickness = 10
  47.        
  48.         local layout = Instance.new("UIListLayout",scrollingFrame)
  49.         layout.Padding = UDim.new(0,5)
  50.         layout.Name = "Layout"
  51.        
  52.         for _,value in pairs (values) do
  53.             local textButton = Instance.new("TextButton",scrollingFrame)
  54.             textButton.Name = value
  55.             textButton.Text = value
  56.             textButton.Size = UDim2.new(1,0,0.075,0)
  57.             textButton.BackgroundTransparency = 0.75
  58.             textButton.BorderSizePixel = 0
  59.             textButton.TextScaled = true
  60.             textButton.TextWrapped = true
  61.             textButton.Font = Enum.Font.SourceSansLight
  62.             textButton.TextColor3 = Color3.fromRGB(255,255,255)
  63.            
  64.             if textButton.Name == "IntValue" then
  65.                 textButton.MouseButton1Click:Connect(function()
  66.                     scrollingFrame.Visible = false
  67.                     local textBox1 = Instance.new("TextBox",imageHolder)
  68.                     textBox1.Name = "StatName"
  69.                     textBox1.Size = UDim2.new(1,0,0.1,0)
  70.                     textBox1.Position = UDim2.new(0,0,0.3,0)
  71.                     textBox1.AnchorPoint = Vector2.new(0,0.3)
  72.                     textBox1.BackgroundTransparency = 1
  73.                     textBox1.Font = Enum.Font.SourceSansLight
  74.                     textBox1.Text = ""
  75.                     textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  76.                     textBox1.TextColor3 = Color3.fromRGB(255,255,255)
  77.                     textBox1.PlaceholderText = "Enter Stat Name (Ex: Money)"
  78.                     textBox1.TextScaled = true
  79.                     textBox1.TextWrapped = true
  80.                    
  81.                     local textBox2 = Instance.new("TextBox",imageHolder)
  82.                     textBox2.Name = "DefaultValue"
  83.                     textBox2.Size = UDim2.new(1,0,0.1,0)
  84.                     textBox2.Position = UDim2.new(0,0,0.6,0)
  85.                     textBox2.AnchorPoint = Vector2.new(0,0.6)
  86.                     textBox2.BackgroundTransparency = 1
  87.                     textBox2.Font = Enum.Font.SourceSansLight
  88.                     textBox2.Text = ""
  89.                     textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  90.                     textBox2.TextColor3 = Color3.fromRGB(255,255,255)
  91.                     textBox2.PlaceholderText = "Enter Default Value (Ex: 50)"
  92.                     textBox2.TextScaled = true
  93.                     textBox2.TextWrapped = true
  94.                    
  95.                     local textButton2 = Instance.new("TextButton",imageHolder)
  96.                     textButton2.Name = "CreateButton"
  97.                     textButton2.Text = "Create"
  98.                     textButton2.Size = UDim2.new(1,0,0.15,0)
  99.                     textButton2.BackgroundTransparency = 1
  100.                     textButton2.BorderSizePixel = 0
  101.                     textButton2.TextScaled = true
  102.                     textButton2.TextWrapped = true
  103.                     textButton2.Font = Enum.Font.SourceSansLight
  104.                     textButton2.TextColor3 = Color3.fromRGB(255,255,255)
  105.                     textButton2.Position = UDim2.new(0,0,0.9,0)
  106.                     textButton2.AnchorPoint = Vector2.new(0,0.9)
  107.                    
  108.                     textButton2.MouseButton1Click:Connect(function()
  109.                         if textBox1.Text ~= "" then
  110.                             if textBox2.Text ~= "" then
  111.                                 local statName = textBox1.Text
  112.                                 local defaultValue = textBox2.Text
  113.                                                                
  114.                                 local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
  115.                                 serverScript.Name = "Module Handler"
  116.                                
  117.                                 local moduleScript = Instance.new("ModuleScript",serverScript)
  118.                                 moduleScript.Name = "Data Handler"
  119.                                
  120. serverScript.Source = [[
  121. --// killerbrenden 3/5/2020
  122.  
  123. local dataHandler = require(script["Data Handler"])
  124.  
  125. game.Players.PlayerAdded:Connect(function(player)
  126.     dataHandler:LoadData(player)
  127. end)
  128. ]]
  129.  
  130. moduleScript.Source = [[
  131. --// killerbrenden 3/5/2020
  132.  
  133. local dataModule = {}
  134.  
  135. local DataStore2 = require(1936396537)
  136.  
  137. local defaultValue = ]]..defaultValue..[[
  138.  
  139. DataStore2.Combine("_game_data_","]]..statName..[[")
  140.  
  141. function dataModule:LoadData(player)
  142.     local leaderstats = Instance.new("Folder",player)
  143.     leaderstats.Name = "leaderstats"
  144.    
  145.     local ]]..statName..[[ = Instance.new("IntValue",leaderstats)
  146.     ]]..statName..[[.Name = "]]..statName..[["
  147.    
  148.     local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
  149.    
  150.     local function update]]..statName..[[(value)
  151.         player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
  152.     end
  153.    
  154.     update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
  155.    
  156.     ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
  157. end
  158.  
  159. return dataModule
  160. ]]
  161. wait(0.25)
  162. statGui:Destroy()
  163.                             end
  164.                         end
  165.                     end)
  166.                 end)
  167.             elseif textButton.Name == "NumberValue" then
  168.                 textButton.MouseButton1Click:Connect(function()
  169.                     scrollingFrame.Visible = false
  170.                     local textBox1 = Instance.new("TextBox",imageHolder)
  171.                     textBox1.Name = "StatName"
  172.                     textBox1.Size = UDim2.new(1,0,0.1,0)
  173.                     textBox1.Position = UDim2.new(0,0,0.3,0)
  174.                     textBox1.AnchorPoint = Vector2.new(0,0.3)
  175.                     textBox1.BackgroundTransparency = 1
  176.                     textBox1.Font = Enum.Font.SourceSansLight
  177.                     textBox1.Text = ""
  178.                     textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  179.                     textBox1.TextColor3 = Color3.fromRGB(255,255,255)
  180.                     textBox1.PlaceholderText = "Enter Stat Name (Ex: Coins)"
  181.                     textBox1.TextScaled = true
  182.                     textBox1.TextWrapped = true
  183.                    
  184.                     local textBox2 = Instance.new("TextBox",imageHolder)
  185.                     textBox2.Name = "DefaultValue"
  186.                     textBox2.Size = UDim2.new(1,0,0.1,0)
  187.                     textBox2.Position = UDim2.new(0,0,0.6,0)
  188.                     textBox2.AnchorPoint = Vector2.new(0,0.6)
  189.                     textBox2.BackgroundTransparency = 1
  190.                     textBox2.Font = Enum.Font.SourceSansLight
  191.                     textBox2.Text = ""
  192.                     textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  193.                     textBox2.TextColor3 = Color3.fromRGB(255,255,255)
  194.                     textBox2.PlaceholderText = "Enter Default Value (Ex: 25)"
  195.                     textBox2.TextScaled = true
  196.                     textBox2.TextWrapped = true
  197.                    
  198.                     local textButton2 = Instance.new("TextButton",imageHolder)
  199.                     textButton2.Name = "CreateButton"
  200.                     textButton2.Text = "Create"
  201.                     textButton2.Size = UDim2.new(1,0,0.15,0)
  202.                     textButton2.BackgroundTransparency = 1
  203.                     textButton2.BorderSizePixel = 0
  204.                     textButton2.TextScaled = true
  205.                     textButton2.TextWrapped = true
  206.                     textButton2.Font = Enum.Font.SourceSansLight
  207.                     textButton2.TextColor3 = Color3.fromRGB(255,255,255)
  208.                     textButton2.Position = UDim2.new(0,0,0.9,0)
  209.                     textButton2.AnchorPoint = Vector2.new(0,0.9)
  210.                    
  211.                     textButton2.MouseButton1Click:Connect(function()
  212.                         if textBox1.Text ~= "" then
  213.                             if textBox2.Text ~= "" then
  214.                                 local statName = textBox1.Text
  215.                                 local defaultValue = textBox2.Text
  216.                                                                
  217.                                 local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
  218.                                 serverScript.Name = "Module Handler"
  219.                                
  220.                                 local moduleScript = Instance.new("ModuleScript",serverScript)
  221.                                 moduleScript.Name = "Data Handler"
  222.                                
  223. serverScript.Source = [[
  224. --// killerbrenden 3/5/2020
  225.  
  226. local dataHandler = require(script["Data Handler"])
  227.  
  228. game.Players.PlayerAdded:Connect(function(player)
  229.     dataHandler:LoadData(player)
  230. end)
  231. ]]
  232.  
  233. moduleScript.Source = [[
  234. --// killerbrenden 3/5/2020
  235.  
  236. local dataModule = {}
  237.  
  238. local DataStore2 = require(1936396537)
  239.  
  240. local defaultValue = ]]..defaultValue..[[
  241.  
  242. DataStore2.Combine("_game_data_","]]..statName..[[")
  243.  
  244. function dataModule:LoadData(player)
  245.     local leaderstats = Instance.new("Folder",player)
  246.     leaderstats.Name = "leaderstats"
  247.    
  248.     local ]]..statName..[[ = Instance.new("NumberValue",leaderstats)
  249.     ]]..statName..[[.Name = "]]..statName..[["
  250.    
  251.     local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
  252.    
  253.     local function update]]..statName..[[(value)
  254.         player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
  255.     end
  256.    
  257.     update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
  258.    
  259.     ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
  260. end
  261.  
  262. return dataModule
  263. ]]
  264. wait(0.25)
  265. statGui:Destroy()
  266.                             end
  267.                         end
  268.                     end)
  269.                 end)
  270.             elseif textButton.Name == "StringValue" then
  271.                 textButton.MouseButton1Click:Connect(function()
  272.                     scrollingFrame.Visible = false
  273.                     local textBox1 = Instance.new("TextBox",imageHolder)
  274.                     textBox1.Name = "StatName"
  275.                     textBox1.Size = UDim2.new(1,0,0.1,0)
  276.                     textBox1.Position = UDim2.new(0,0,0.3,0)
  277.                     textBox1.AnchorPoint = Vector2.new(0,0.3)
  278.                     textBox1.BackgroundTransparency = 1
  279.                     textBox1.Font = Enum.Font.SourceSansLight
  280.                     textBox1.Text = ""
  281.                     textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  282.                     textBox1.TextColor3 = Color3.fromRGB(255,255,255)
  283.                     textBox1.PlaceholderText = "Enter Stat Name (Ex: Spell)"
  284.                     textBox1.TextScaled = true
  285.                     textBox1.TextWrapped = true
  286.                    
  287.                     local textBox2 = Instance.new("TextBox",imageHolder)
  288.                     textBox2.Name = "DefaultValue"
  289.                     textBox2.Size = UDim2.new(1,0,0.1,0)
  290.                     textBox2.Position = UDim2.new(0,0,0.6,0)
  291.                     textBox2.AnchorPoint = Vector2.new(0,0.6)
  292.                     textBox2.BackgroundTransparency = 1
  293.                     textBox2.Font = Enum.Font.SourceSansLight
  294.                     textBox2.Text = ""
  295.                     textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  296.                     textBox2.TextColor3 = Color3.fromRGB(255,255,255)
  297.                     textBox2.PlaceholderText = "Enter Default Value (Ex: None)"
  298.                     textBox2.TextScaled = true
  299.                     textBox2.TextWrapped = true
  300.                    
  301.                     local textButton2 = Instance.new("TextButton",imageHolder)
  302.                     textButton2.Name = "CreateButton"
  303.                     textButton2.Text = "Create"
  304.                     textButton2.Size = UDim2.new(1,0,0.15,0)
  305.                     textButton2.BackgroundTransparency = 1
  306.                     textButton2.BorderSizePixel = 0
  307.                     textButton2.TextScaled = true
  308.                     textButton2.TextWrapped = true
  309.                     textButton2.Font = Enum.Font.SourceSansLight
  310.                     textButton2.TextColor3 = Color3.fromRGB(255,255,255)
  311.                     textButton2.Position = UDim2.new(0,0,0.9,0)
  312.                     textButton2.AnchorPoint = Vector2.new(0,0.9)
  313.                    
  314.                     textButton2.MouseButton1Click:Connect(function()
  315.                         if textBox1.Text ~= "" then
  316.                             if textBox2.Text ~= "" then
  317.                                 local statName = textBox1.Text
  318.                                 local defaultValue = textBox2.Text
  319.                                                                
  320.                                 local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
  321.                                 serverScript.Name = "Module Handler"
  322.                                
  323.                                 local moduleScript = Instance.new("ModuleScript",serverScript)
  324.                                 moduleScript.Name = "Data Handler"
  325.                                
  326. serverScript.Source = [[
  327. --// killerbrenden 3/5/2020
  328.  
  329. local dataHandler = require(script["Data Handler"])
  330.  
  331. game.Players.PlayerAdded:Connect(function(player)
  332.     dataHandler:LoadData(player)
  333. end)
  334. ]]
  335.  
  336. moduleScript.Source = [[
  337. --// killerbrenden 3/5/2020
  338.  
  339. local dataModule = {}
  340.  
  341. local DataStore2 = require(1936396537)
  342.  
  343. local defaultValue = "]]..defaultValue..[["
  344.  
  345. DataStore2.Combine("_game_data_","]]..statName..[[")
  346.  
  347. function dataModule:LoadData(player)
  348.     local leaderstats = Instance.new("Folder",player)
  349.     leaderstats.Name = "leaderstats"
  350.    
  351.     local ]]..statName..[[ = Instance.new("StringValue",leaderstats)
  352.     ]]..statName..[[.Name = "]]..statName..[["
  353.    
  354.     local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
  355.    
  356.     local function update]]..statName..[[(value)
  357.         player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
  358.     end
  359.    
  360.     update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
  361.    
  362.     ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
  363. end
  364.  
  365. return dataModule
  366. ]]
  367. wait(0.25)
  368. statGui:Destroy()
  369.                             end
  370.                         end
  371.                     end)
  372.                 end)
  373.             elseif textButton.Name == "BoolValue" then
  374.                 textButton.MouseButton1Click:Connect(function()
  375.                     scrollingFrame.Visible = false
  376.                     local textBox1 = Instance.new("TextBox",imageHolder)
  377.                     textBox1.Name = "StatName"
  378.                     textBox1.Size = UDim2.new(1,0,0.1,0)
  379.                     textBox1.Position = UDim2.new(0,0,0.3,0)
  380.                     textBox1.AnchorPoint = Vector2.new(0,0.3)
  381.                     textBox1.BackgroundTransparency = 1
  382.                     textBox1.Font = Enum.Font.SourceSansLight
  383.                     textBox1.Text = ""
  384.                     textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  385.                     textBox1.TextColor3 = Color3.fromRGB(255,255,255)
  386.                     textBox1.PlaceholderText = "Enter Stat Name (Ex: HasCar)"
  387.                     textBox1.TextScaled = true
  388.                     textBox1.TextWrapped = true
  389.                    
  390.                     local textBox2 = Instance.new("TextBox",imageHolder)
  391.                     textBox2.Name = "DefaultValue"
  392.                     textBox2.Size = UDim2.new(1,0,0.1,0)
  393.                     textBox2.Position = UDim2.new(0,0,0.6,0)
  394.                     textBox2.AnchorPoint = Vector2.new(0,0.6)
  395.                     textBox2.BackgroundTransparency = 1
  396.                     textBox2.Font = Enum.Font.SourceSansLight
  397.                     textBox2.Text = ""
  398.                     textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
  399.                     textBox2.TextColor3 = Color3.fromRGB(255,255,255)
  400.                     textBox2.PlaceholderText = "Enter Default Value (Ex: false)"
  401.                     textBox2.TextScaled = true
  402.                     textBox2.TextWrapped = true
  403.                    
  404.                     local textButton2 = Instance.new("TextButton",imageHolder)
  405.                     textButton2.Name = "CreateButton"
  406.                     textButton2.Text = "Create"
  407.                     textButton2.Size = UDim2.new(1,0,0.15,0)
  408.                     textButton2.BackgroundTransparency = 1
  409.                     textButton2.BorderSizePixel = 0
  410.                     textButton2.TextScaled = true
  411.                     textButton2.TextWrapped = true
  412.                     textButton2.Font = Enum.Font.SourceSansLight
  413.                     textButton2.TextColor3 = Color3.fromRGB(255,255,255)
  414.                     textButton2.Position = UDim2.new(0,0,0.9,0)
  415.                     textButton2.AnchorPoint = Vector2.new(0,0.9)
  416.                    
  417.                     textButton2.MouseButton1Click:Connect(function()
  418.                         if textBox1.Text ~= "" then
  419.                             if textBox2.Text ~= "" then
  420.                                 local statName = textBox1.Text
  421.                                 local defaultValue = string.lower(textBox2.Text)
  422.                                                                
  423.                                 local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
  424.                                 serverScript.Name = "Module Handler"
  425.                                
  426.                                 local moduleScript = Instance.new("ModuleScript",serverScript)
  427.                                 moduleScript.Name = "Data Handler"
  428.                                
  429. serverScript.Source = [[
  430. --// killerbrenden 3/5/2020
  431.  
  432. local dataHandler = require(script["Data Handler"])
  433.  
  434. game.Players.PlayerAdded:Connect(function(player)
  435.     dataHandler:LoadData(player)
  436. end)
  437. ]]
  438.  
  439. moduleScript.Source = [[
  440. --// killerbrenden 3/5/2020
  441.  
  442. local dataModule = {}
  443.  
  444. local DataStore2 = require(1936396537)
  445.  
  446. local defaultValue = ]]..defaultValue..[[
  447.  
  448. DataStore2.Combine("_game_data_","]]..statName..[[")
  449.  
  450. function dataModule:LoadData(player)
  451.     local leaderstats = Instance.new("Folder",player)
  452.     leaderstats.Name = "leaderstats"
  453.    
  454.     local ]]..statName..[[ = Instance.new("BoolValue",leaderstats)
  455.     ]]..statName..[[.Name = "]]..statName..[["
  456.    
  457.     local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
  458.    
  459.     local function update]]..statName..[[(value)
  460.         player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
  461.     end
  462.    
  463.     update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
  464.    
  465.     ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
  466. end
  467.  
  468. return dataModule
  469. ]]
  470. wait(0.25)
  471. statGui:Destroy()
  472.         end
  473.     end
  474. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement