Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local toolbar = plugin:CreateToolbar("Stat Creator")
- local button = toolbar:CreateButton(
- "Create Custom Stat",
- "Create A New Custom Stat Script",
- ""
- )
- button.Click:Connect(function()
- if game:GetService("CoreGui"):FindFirstChild("StatGui") then
- game:GetService("CoreGui"):FindFirstChild("StatGui"):Destroy()
- else
- local statGui = Instance.new("ScreenGui",game:GetService("CoreGui"))
- statGui.Name = "StatGui"
- local values = {"BoolValue","IntValue","NumberValue","StringValue"}
- --// Visuals
- local imageHolder = Instance.new("ImageLabel",statGui)
- imageHolder.Name = "MainFrame"
- imageHolder.Size = UDim2.new(0.5,0,0.5,0)
- imageHolder.AnchorPoint = Vector2.new(0.5,0.5)
- imageHolder.BackgroundTransparency = 1
- imageHolder.Position = UDim2.new(0.5,0,0.5,0)
- imageHolder.Image = "rbxassetid://3570695787"
- imageHolder.ImageTransparency = 0.5
- imageHolder.ImageColor3 = Color3.fromRGB(10,10,10)
- imageHolder.ScaleType = Enum.ScaleType.Slice
- imageHolder.SliceCenter = Rect.new(100,100,100,100)
- imageHolder.SliceScale = 0.12
- local textLabel = Instance.new("TextLabel",imageHolder)
- textLabel.Name = "Title"
- textLabel.BackgroundTransparency = 1
- textLabel.Size = UDim2.new(1,0,0.15,0)
- textLabel.TextScaled = true
- textLabel.TextWrapped = true
- textLabel.TextColor3 = Color3.fromRGB(225,225,225)
- textLabel.Font = Enum.Font.SourceSansLight
- textLabel.Text = "Custom Stat Creator"
- local scrollingFrame = Instance.new("ScrollingFrame",imageHolder)
- scrollingFrame.Position = UDim2.new(0,0,0.25,0)
- scrollingFrame.Size = UDim2.new(1,0,0.75,0)
- scrollingFrame.BackgroundTransparency = 1
- scrollingFrame.ScrollBarThickness = 10
- local layout = Instance.new("UIListLayout",scrollingFrame)
- layout.Padding = UDim.new(0,5)
- layout.Name = "Layout"
- for _,value in pairs (values) do
- local textButton = Instance.new("TextButton",scrollingFrame)
- textButton.Name = value
- textButton.Text = value
- textButton.Size = UDim2.new(1,0,0.075,0)
- textButton.BackgroundTransparency = 0.75
- textButton.BorderSizePixel = 0
- textButton.TextScaled = true
- textButton.TextWrapped = true
- textButton.Font = Enum.Font.SourceSansLight
- textButton.TextColor3 = Color3.fromRGB(255,255,255)
- if textButton.Name == "IntValue" then
- textButton.MouseButton1Click:Connect(function()
- scrollingFrame.Visible = false
- local textBox1 = Instance.new("TextBox",imageHolder)
- textBox1.Name = "StatName"
- textBox1.Size = UDim2.new(1,0,0.1,0)
- textBox1.Position = UDim2.new(0,0,0.3,0)
- textBox1.AnchorPoint = Vector2.new(0,0.3)
- textBox1.BackgroundTransparency = 1
- textBox1.Font = Enum.Font.SourceSansLight
- textBox1.Text = ""
- textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox1.TextColor3 = Color3.fromRGB(255,255,255)
- textBox1.PlaceholderText = "Enter Stat Name (Ex: Money)"
- textBox1.TextScaled = true
- textBox1.TextWrapped = true
- local textBox2 = Instance.new("TextBox",imageHolder)
- textBox2.Name = "DefaultValue"
- textBox2.Size = UDim2.new(1,0,0.1,0)
- textBox2.Position = UDim2.new(0,0,0.6,0)
- textBox2.AnchorPoint = Vector2.new(0,0.6)
- textBox2.BackgroundTransparency = 1
- textBox2.Font = Enum.Font.SourceSansLight
- textBox2.Text = ""
- textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox2.TextColor3 = Color3.fromRGB(255,255,255)
- textBox2.PlaceholderText = "Enter Default Value (Ex: 50)"
- textBox2.TextScaled = true
- textBox2.TextWrapped = true
- local textButton2 = Instance.new("TextButton",imageHolder)
- textButton2.Name = "CreateButton"
- textButton2.Text = "Create"
- textButton2.Size = UDim2.new(1,0,0.15,0)
- textButton2.BackgroundTransparency = 1
- textButton2.BorderSizePixel = 0
- textButton2.TextScaled = true
- textButton2.TextWrapped = true
- textButton2.Font = Enum.Font.SourceSansLight
- textButton2.TextColor3 = Color3.fromRGB(255,255,255)
- textButton2.Position = UDim2.new(0,0,0.9,0)
- textButton2.AnchorPoint = Vector2.new(0,0.9)
- textButton2.MouseButton1Click:Connect(function()
- if textBox1.Text ~= "" then
- if textBox2.Text ~= "" then
- local statName = textBox1.Text
- local defaultValue = textBox2.Text
- local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
- serverScript.Name = "Module Handler"
- local moduleScript = Instance.new("ModuleScript",serverScript)
- moduleScript.Name = "Data Handler"
- serverScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataHandler = require(script["Data Handler"])
- game.Players.PlayerAdded:Connect(function(player)
- dataHandler:LoadData(player)
- end)
- ]]
- moduleScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataModule = {}
- local DataStore2 = require(1936396537)
- local defaultValue = ]]..defaultValue..[[
- DataStore2.Combine("_game_data_","]]..statName..[[")
- function dataModule:LoadData(player)
- local leaderstats = Instance.new("Folder",player)
- leaderstats.Name = "leaderstats"
- local ]]..statName..[[ = Instance.new("IntValue",leaderstats)
- ]]..statName..[[.Name = "]]..statName..[["
- local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
- local function update]]..statName..[[(value)
- player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
- end
- update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
- ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
- end
- return dataModule
- ]]
- wait(0.25)
- statGui:Destroy()
- end
- end
- end)
- end)
- elseif textButton.Name == "NumberValue" then
- textButton.MouseButton1Click:Connect(function()
- scrollingFrame.Visible = false
- local textBox1 = Instance.new("TextBox",imageHolder)
- textBox1.Name = "StatName"
- textBox1.Size = UDim2.new(1,0,0.1,0)
- textBox1.Position = UDim2.new(0,0,0.3,0)
- textBox1.AnchorPoint = Vector2.new(0,0.3)
- textBox1.BackgroundTransparency = 1
- textBox1.Font = Enum.Font.SourceSansLight
- textBox1.Text = ""
- textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox1.TextColor3 = Color3.fromRGB(255,255,255)
- textBox1.PlaceholderText = "Enter Stat Name (Ex: Coins)"
- textBox1.TextScaled = true
- textBox1.TextWrapped = true
- local textBox2 = Instance.new("TextBox",imageHolder)
- textBox2.Name = "DefaultValue"
- textBox2.Size = UDim2.new(1,0,0.1,0)
- textBox2.Position = UDim2.new(0,0,0.6,0)
- textBox2.AnchorPoint = Vector2.new(0,0.6)
- textBox2.BackgroundTransparency = 1
- textBox2.Font = Enum.Font.SourceSansLight
- textBox2.Text = ""
- textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox2.TextColor3 = Color3.fromRGB(255,255,255)
- textBox2.PlaceholderText = "Enter Default Value (Ex: 25)"
- textBox2.TextScaled = true
- textBox2.TextWrapped = true
- local textButton2 = Instance.new("TextButton",imageHolder)
- textButton2.Name = "CreateButton"
- textButton2.Text = "Create"
- textButton2.Size = UDim2.new(1,0,0.15,0)
- textButton2.BackgroundTransparency = 1
- textButton2.BorderSizePixel = 0
- textButton2.TextScaled = true
- textButton2.TextWrapped = true
- textButton2.Font = Enum.Font.SourceSansLight
- textButton2.TextColor3 = Color3.fromRGB(255,255,255)
- textButton2.Position = UDim2.new(0,0,0.9,0)
- textButton2.AnchorPoint = Vector2.new(0,0.9)
- textButton2.MouseButton1Click:Connect(function()
- if textBox1.Text ~= "" then
- if textBox2.Text ~= "" then
- local statName = textBox1.Text
- local defaultValue = textBox2.Text
- local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
- serverScript.Name = "Module Handler"
- local moduleScript = Instance.new("ModuleScript",serverScript)
- moduleScript.Name = "Data Handler"
- serverScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataHandler = require(script["Data Handler"])
- game.Players.PlayerAdded:Connect(function(player)
- dataHandler:LoadData(player)
- end)
- ]]
- moduleScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataModule = {}
- local DataStore2 = require(1936396537)
- local defaultValue = ]]..defaultValue..[[
- DataStore2.Combine("_game_data_","]]..statName..[[")
- function dataModule:LoadData(player)
- local leaderstats = Instance.new("Folder",player)
- leaderstats.Name = "leaderstats"
- local ]]..statName..[[ = Instance.new("NumberValue",leaderstats)
- ]]..statName..[[.Name = "]]..statName..[["
- local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
- local function update]]..statName..[[(value)
- player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
- end
- update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
- ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
- end
- return dataModule
- ]]
- wait(0.25)
- statGui:Destroy()
- end
- end
- end)
- end)
- elseif textButton.Name == "StringValue" then
- textButton.MouseButton1Click:Connect(function()
- scrollingFrame.Visible = false
- local textBox1 = Instance.new("TextBox",imageHolder)
- textBox1.Name = "StatName"
- textBox1.Size = UDim2.new(1,0,0.1,0)
- textBox1.Position = UDim2.new(0,0,0.3,0)
- textBox1.AnchorPoint = Vector2.new(0,0.3)
- textBox1.BackgroundTransparency = 1
- textBox1.Font = Enum.Font.SourceSansLight
- textBox1.Text = ""
- textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox1.TextColor3 = Color3.fromRGB(255,255,255)
- textBox1.PlaceholderText = "Enter Stat Name (Ex: Spell)"
- textBox1.TextScaled = true
- textBox1.TextWrapped = true
- local textBox2 = Instance.new("TextBox",imageHolder)
- textBox2.Name = "DefaultValue"
- textBox2.Size = UDim2.new(1,0,0.1,0)
- textBox2.Position = UDim2.new(0,0,0.6,0)
- textBox2.AnchorPoint = Vector2.new(0,0.6)
- textBox2.BackgroundTransparency = 1
- textBox2.Font = Enum.Font.SourceSansLight
- textBox2.Text = ""
- textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox2.TextColor3 = Color3.fromRGB(255,255,255)
- textBox2.PlaceholderText = "Enter Default Value (Ex: None)"
- textBox2.TextScaled = true
- textBox2.TextWrapped = true
- local textButton2 = Instance.new("TextButton",imageHolder)
- textButton2.Name = "CreateButton"
- textButton2.Text = "Create"
- textButton2.Size = UDim2.new(1,0,0.15,0)
- textButton2.BackgroundTransparency = 1
- textButton2.BorderSizePixel = 0
- textButton2.TextScaled = true
- textButton2.TextWrapped = true
- textButton2.Font = Enum.Font.SourceSansLight
- textButton2.TextColor3 = Color3.fromRGB(255,255,255)
- textButton2.Position = UDim2.new(0,0,0.9,0)
- textButton2.AnchorPoint = Vector2.new(0,0.9)
- textButton2.MouseButton1Click:Connect(function()
- if textBox1.Text ~= "" then
- if textBox2.Text ~= "" then
- local statName = textBox1.Text
- local defaultValue = textBox2.Text
- local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
- serverScript.Name = "Module Handler"
- local moduleScript = Instance.new("ModuleScript",serverScript)
- moduleScript.Name = "Data Handler"
- serverScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataHandler = require(script["Data Handler"])
- game.Players.PlayerAdded:Connect(function(player)
- dataHandler:LoadData(player)
- end)
- ]]
- moduleScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataModule = {}
- local DataStore2 = require(1936396537)
- local defaultValue = "]]..defaultValue..[["
- DataStore2.Combine("_game_data_","]]..statName..[[")
- function dataModule:LoadData(player)
- local leaderstats = Instance.new("Folder",player)
- leaderstats.Name = "leaderstats"
- local ]]..statName..[[ = Instance.new("StringValue",leaderstats)
- ]]..statName..[[.Name = "]]..statName..[["
- local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
- local function update]]..statName..[[(value)
- player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
- end
- update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
- ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
- end
- return dataModule
- ]]
- wait(0.25)
- statGui:Destroy()
- end
- end
- end)
- end)
- elseif textButton.Name == "BoolValue" then
- textButton.MouseButton1Click:Connect(function()
- scrollingFrame.Visible = false
- local textBox1 = Instance.new("TextBox",imageHolder)
- textBox1.Name = "StatName"
- textBox1.Size = UDim2.new(1,0,0.1,0)
- textBox1.Position = UDim2.new(0,0,0.3,0)
- textBox1.AnchorPoint = Vector2.new(0,0.3)
- textBox1.BackgroundTransparency = 1
- textBox1.Font = Enum.Font.SourceSansLight
- textBox1.Text = ""
- textBox1.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox1.TextColor3 = Color3.fromRGB(255,255,255)
- textBox1.PlaceholderText = "Enter Stat Name (Ex: HasCar)"
- textBox1.TextScaled = true
- textBox1.TextWrapped = true
- local textBox2 = Instance.new("TextBox",imageHolder)
- textBox2.Name = "DefaultValue"
- textBox2.Size = UDim2.new(1,0,0.1,0)
- textBox2.Position = UDim2.new(0,0,0.6,0)
- textBox2.AnchorPoint = Vector2.new(0,0.6)
- textBox2.BackgroundTransparency = 1
- textBox2.Font = Enum.Font.SourceSansLight
- textBox2.Text = ""
- textBox2.PlaceholderColor3 = Color3.fromRGB(255,255,255)
- textBox2.TextColor3 = Color3.fromRGB(255,255,255)
- textBox2.PlaceholderText = "Enter Default Value (Ex: false)"
- textBox2.TextScaled = true
- textBox2.TextWrapped = true
- local textButton2 = Instance.new("TextButton",imageHolder)
- textButton2.Name = "CreateButton"
- textButton2.Text = "Create"
- textButton2.Size = UDim2.new(1,0,0.15,0)
- textButton2.BackgroundTransparency = 1
- textButton2.BorderSizePixel = 0
- textButton2.TextScaled = true
- textButton2.TextWrapped = true
- textButton2.Font = Enum.Font.SourceSansLight
- textButton2.TextColor3 = Color3.fromRGB(255,255,255)
- textButton2.Position = UDim2.new(0,0,0.9,0)
- textButton2.AnchorPoint = Vector2.new(0,0.9)
- textButton2.MouseButton1Click:Connect(function()
- if textBox1.Text ~= "" then
- if textBox2.Text ~= "" then
- local statName = textBox1.Text
- local defaultValue = string.lower(textBox2.Text)
- local serverScript = Instance.new("Script",game:GetService("ServerScriptService"))
- serverScript.Name = "Module Handler"
- local moduleScript = Instance.new("ModuleScript",serverScript)
- moduleScript.Name = "Data Handler"
- serverScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataHandler = require(script["Data Handler"])
- game.Players.PlayerAdded:Connect(function(player)
- dataHandler:LoadData(player)
- end)
- ]]
- moduleScript.Source = [[
- --// killerbrenden 3/5/2020
- local dataModule = {}
- local DataStore2 = require(1936396537)
- local defaultValue = ]]..defaultValue..[[
- DataStore2.Combine("_game_data_","]]..statName..[[")
- function dataModule:LoadData(player)
- local leaderstats = Instance.new("Folder",player)
- leaderstats.Name = "leaderstats"
- local ]]..statName..[[ = Instance.new("BoolValue",leaderstats)
- ]]..statName..[[.Name = "]]..statName..[["
- local ]]..statName..[[Store = DataStore2("]]..statName..[[",player)
- local function update]]..statName..[[(value)
- player:WaitForChild("leaderstats"):FindFirstChild("]]..statName..[[").Value = value
- end
- update]]..statName..[[(]]..statName..[[Store:Get(defaultValue))
- ]]..statName..[[Store:OnUpdate(update]]..statName..[[)
- end
- return dataModule
- ]]
- wait(0.25)
- statGui:Destroy()
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement