KrYn0MoRe

stud currency script

May 2nd, 2020
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.63 KB | None | 0 0
  1. function stud_convert(n, Mode)
  2.     local left = n
  3.     local TH2,TH,H,T
  4. if Mode == 1 then
  5.     TH2 = (left-(left%10000)) or 0
  6. left = left-TH2
  7.     TH = (left-(left%1000)) or 0
  8. left = left-TH
  9.     H = (left-(left%100)) or 0
  10. left = left-H
  11.     T = (left-(left%10)) or 0
  12. left = left-T
  13. elseif Mode == 2 then
  14.     TH2 = (left-(left%10000))/10000 or 0
  15. left = left-TH2*10000
  16.     TH = (left-(left%1000))/1000 or 0
  17. left = left-TH*1000
  18.     H = (left-(left%100))/100 or 0
  19. left = left-H*100
  20.     T = (left-(left%10))/10 or 0
  21. left = left-T*10
  22. end
  23.     return TH2, TH, H, T
  24. end
  25.  
  26. function create_stud(color,p,Name)
  27. local part = Instance.new("Part")
  28. part.Name = Name
  29. part.Color = color
  30. part.Size = Vector3.new(1, 1, 1)
  31. part.Locked = true
  32. part.BackSurface = Enum.SurfaceType.Studs
  33. part.BottomSurface = Enum.SurfaceType.Studs
  34. part.FrontSurface = Enum.SurfaceType.Studs
  35. part.LeftSurface = Enum.SurfaceType.Studs
  36. part.RightSurface = Enum.SurfaceType.Studs
  37. part.Parent = p
  38. --game:GetService("Debris"):AddItem(part,30)
  39. return part
  40. end
  41.  
  42. function stud_drop(Torso, Amount, Mode, Purple, Blue, Gold, Silver)
  43.     if Mode == 2 then
  44.         local P = create_stud(Color3.fromRGB(255, 255, 255), script,'Big Pip')
  45.         P.Size = Vector3.new(4,4,4)
  46.         P.Reflectance = 1
  47.         P.CFrame = Torso.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,7,-6)
  48.         --[[
  49.         local billboard = Instance.new("BillboardGui")
  50.         local giveamount = Instance.new("TextBox")
  51.         billboard.Parent = P
  52.         billboard.Size = UDim2.new(10, 10, 0.5, 1)
  53.         billboard.Active = true
  54.         billboard.StudsOffset = Vector3.new(0, 1.5, 0)
  55.         giveamount.Name = "Text"
  56.         giveamount.Parent = billboard
  57.         giveamount.Size = UDim2.new(1, 1, 1, 1)
  58.         giveamount.BackgroundColor = BrickColor.new("Really black")
  59.         giveamount.BackgroundColor3 = Color3.new(0, 0, 0)
  60.         giveamount.BackgroundTransparency = 1
  61.         giveamount.BorderColor = BrickColor.new("Really black")
  62.         giveamount.BorderColor3 = Color3.new(0, 0, 0)
  63.         giveamount.Font = Enum.Font.Code
  64.         giveamount.FontSize = Enum.FontSize.Size14
  65.         giveamount.Text = "1000"
  66.         giveamount.TextColor = BrickColor.new("Institutional white")
  67.         giveamount.TextColor3 = Color3.new(1, 1, 1)
  68.         giveamount.TextScaled = true
  69.         giveamount.TextSize = 14
  70.         giveamount.TextStrokeTransparency = 0
  71.         giveamount.TextWrap = true
  72.         giveamount.TextWrapped = true
  73.         giveamount.TextYAlignment = Enum.TextYAlignment.Top
  74.         giveamount.ClearTextOnFocus = false
  75.         giveamount.MultiLine = true
  76.         ]]
  77.         local touched = false
  78.         P.Touched:Connect(function(obj)
  79.             if touched then return end
  80.             local char,hum,studs,antistuds
  81.             pcall(function()
  82.                 char = obj.Parent
  83.             end)
  84.             pcall(function()
  85.                 hum = char:FindFirstChildOfClass("Humanoid")
  86.             end)
  87.             pcall(function()
  88.                 studs = hum:FindFirstChild("Studs Balance")
  89.             end)
  90.             pcall(function()
  91.                 antistuds = hum:FindFirstChild("S.B.A.C")
  92.             end)
  93.             if char and hum and hum.Health > 0 and studs and antistuds then
  94.                 antistuds.Value = true
  95.                 touched = true
  96.                 studs.Value = studs.Value + Amount
  97.                 P:Destroy()
  98.                 wait()
  99.                 antistuds.Value = false
  100.             end
  101.         end)
  102.     end
  103.     if Mode == 1 then else return end
  104.     for i = 1,Purple do
  105.         local P = create_stud(Color3.fromRGB(61, 21, 133), script,'Purple Pip')
  106.         P.CFrame = Torso.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,3,-6)
  107.         --[[
  108.         local billboard = Instance.new("BillboardGui")
  109.         local giveamount = Instance.new("TextBox")
  110.         billboard.Parent = P
  111.         billboard.Size = UDim2.new(10, 10, 0.5, 1)
  112.         billboard.Active = true
  113.         billboard.StudsOffset = Vector3.new(0, 1, 0)
  114.         giveamount.Name = "Text"
  115.         giveamount.Parent = billboard
  116.         giveamount.Size = UDim2.new(1, 1, 1, 1)
  117.         giveamount.BackgroundColor = BrickColor.new("Really black")
  118.         giveamount.BackgroundColor3 = Color3.new(0, 0, 0)
  119.         giveamount.BackgroundTransparency = 1
  120.         giveamount.BorderColor = BrickColor.new("Really black")
  121.         giveamount.BorderColor3 = Color3.new(0, 0, 0)
  122.         giveamount.Font = Enum.Font.Code
  123.         giveamount.FontSize = Enum.FontSize.Size14
  124.         giveamount.Text = tostring(Amount)
  125.         giveamount.TextColor = BrickColor.new("Institutional white")
  126.         giveamount.TextColor3 = Color3.new(1, 1, 1)
  127.         giveamount.TextScaled = true
  128.         giveamount.TextSize = 14
  129.         giveamount.TextStrokeTransparency = 0
  130.         giveamount.TextWrap = true
  131.         giveamount.TextWrapped = true
  132.         giveamount.TextYAlignment = Enum.TextYAlignment.Top
  133.         giveamount.ClearTextOnFocus = false
  134.         giveamount.MultiLine = true
  135.         ]]
  136.         local touched = false
  137.         P.Touched:Connect(function(obj)
  138.             if touched then return end
  139.             local char,hum,studs,antistuds
  140.             pcall(function()
  141.                 char = obj.Parent
  142.             end)
  143.             pcall(function()
  144.                 hum = char:FindFirstChildOfClass("Humanoid")
  145.             end)
  146.             pcall(function()
  147.                 studs = hum:FindFirstChild("Studs Balance")
  148.             end)
  149.             pcall(function()
  150.                 antistuds = hum:FindFirstChild("S.B.A.C")
  151.             end)
  152.             if char and hum and hum.Health > 0 and studs and antistuds then
  153.                 antistuds.Value = true
  154.                 touched = true
  155.                 studs.Value = studs.Value + 10000
  156.                 P:Destroy()
  157.                 wait()
  158.                 antistuds.Value = false
  159.             end
  160.         end)
  161.     end
  162.     for i = 1,Blue do
  163.         local B = create_stud(Color3.fromRGB(9, 137, 207), script,'Blue Pip')
  164.         B.CFrame = Torso.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,3,-6)
  165.         --[[
  166.         local billboard = Instance.new("BillboardGui")
  167.         local giveamount = Instance.new("TextBox")
  168.         billboard.Parent = B
  169.         billboard.Size = UDim2.new(10, 10, 0.5, 1)
  170.         billboard.Active = true
  171.         billboard.StudsOffset = Vector3.new(0, 1, 0)
  172.         giveamount.Name = "Text"
  173.         giveamount.Parent = billboard
  174.         giveamount.Size = UDim2.new(1, 1, 1, 1)
  175.         giveamount.BackgroundColor = BrickColor.new("Really black")
  176.         giveamount.BackgroundColor3 = Color3.new(0, 0, 0)
  177.         giveamount.BackgroundTransparency = 1
  178.         giveamount.BorderColor = BrickColor.new("Really black")
  179.         giveamount.BorderColor3 = Color3.new(0, 0, 0)
  180.         giveamount.Font = Enum.Font.Code
  181.         giveamount.FontSize = Enum.FontSize.Size14
  182.         giveamount.Text = "1000"
  183.         giveamount.TextColor = BrickColor.new("Institutional white")
  184.         giveamount.TextColor3 = Color3.new(1, 1, 1)
  185.         giveamount.TextScaled = true
  186.         giveamount.TextSize = 14
  187.         giveamount.TextStrokeTransparency = 0
  188.         giveamount.TextWrap = true
  189.         giveamount.TextWrapped = true
  190.         giveamount.TextYAlignment = Enum.TextYAlignment.Top
  191.         giveamount.ClearTextOnFocus = false
  192.         giveamount.MultiLine = true
  193.         ]]
  194.         local touched = false
  195.         B.Touched:Connect(function(obj)
  196.             if touched then return end
  197.             local char,hum,studs,antistuds
  198.             pcall(function()
  199.                 char = obj.Parent
  200.             end)
  201.             pcall(function()
  202.                 hum = char:FindFirstChildOfClass("Humanoid")
  203.             end)
  204.             pcall(function()
  205.                 studs = hum:FindFirstChild("Studs Balance")
  206.             end)
  207.             pcall(function()
  208.                 antistuds = hum:FindFirstChild("S.B.A.C")
  209.             end)
  210.             if char and hum and hum.Health > 0 and studs and antistuds then
  211.                 antistuds.Value = true
  212.                 touched = true
  213.                 studs.Value = studs.Value + 1000
  214.                 B:Destroy()
  215.                 wait()
  216.                 antistuds.Value = false
  217.             end
  218.         end)
  219.     end
  220.     for i = 1,Gold do
  221.         local G = create_stud(Color3.fromRGB(239, 184, 56), script,'Gold Pip')
  222.         G.CFrame = Torso.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,3,-6)
  223.         --[[
  224.         local billboard = Instance.new("BillboardGui")
  225.         local giveamount = Instance.new("TextBox")
  226.         billboard.Parent = G
  227.         billboard.Size = UDim2.new(10, 10, 0.5, 1)
  228.         billboard.Active = true
  229.         billboard.StudsOffset = Vector3.new(0, 1, 0)
  230.         giveamount.Name = "Text"
  231.         giveamount.Parent = billboard
  232.         giveamount.Size = UDim2.new(1, 1, 1, 1)
  233.         giveamount.BackgroundColor = BrickColor.new("Really black")
  234.         giveamount.BackgroundColor3 = Color3.new(0, 0, 0)
  235.         giveamount.BackgroundTransparency = 1
  236.         giveamount.BorderColor = BrickColor.new("Really black")
  237.         giveamount.BorderColor3 = Color3.new(0, 0, 0)
  238.         giveamount.Font = Enum.Font.Code
  239.         giveamount.FontSize = Enum.FontSize.Size14
  240.         giveamount.Text = "100"
  241.         giveamount.TextColor = BrickColor.new("Institutional white")
  242.         giveamount.TextColor3 = Color3.new(1, 1, 1)
  243.         giveamount.TextScaled = true
  244.         giveamount.TextSize = 14
  245.         giveamount.TextStrokeTransparency = 0
  246.         giveamount.TextWrap = true
  247.         giveamount.TextWrapped = true
  248.         giveamount.TextYAlignment = Enum.TextYAlignment.Top
  249.         giveamount.ClearTextOnFocus = false
  250.         giveamount.MultiLine = true
  251.         ]]
  252.         local touched = false
  253.         G.Touched:Connect(function(obj)
  254.             if touched then return end
  255.             local char,hum,studs,antistuds
  256.             pcall(function()
  257.                 char = obj.Parent
  258.             end)
  259.             pcall(function()
  260.                 hum = char:FindFirstChildOfClass("Humanoid")
  261.             end)
  262.             pcall(function()
  263.                 studs = hum:FindFirstChild("Studs Balance")
  264.             end)
  265.             pcall(function()
  266.                 antistuds = hum:FindFirstChild("S.B.A.C")
  267.             end)
  268.             if char and hum and hum.Health > 0 and studs and antistuds then
  269.                 antistuds.Value = true
  270.                 touched = true
  271.                 studs.Value = studs.Value + 100
  272.                 G:Destroy()
  273.                 wait()
  274.                 antistuds.Value = false
  275.             end
  276.         end)
  277.     end
  278.     for i = 1,Silver do
  279.         local S = create_stud(Color3.fromRGB(255, 255, 255), script,'Silver Pip')
  280.         S.Reflectance = 0.6
  281.         S.CFrame = Torso.CFrame*CFrame.Angles(0,0,0)*CFrame.new(0,3,-6)
  282.         --[[
  283.         local billboard = Instance.new("BillboardGui")
  284.         local giveamount = Instance.new("TextBox")
  285.         billboard.Parent = S
  286.         billboard.Size = UDim2.new(10, 10, 0.5, 1)
  287.         billboard.Active = true
  288.         billboard.StudsOffset = Vector3.new(0, 1, 0)
  289.         giveamount.Name = "Text"
  290.         giveamount.Parent = billboard
  291.         giveamount.Size = UDim2.new(1, 1, 1, 1)
  292.         giveamount.BackgroundColor = BrickColor.new("Really black")
  293.         giveamount.BackgroundColor3 = Color3.new(0, 0, 0)
  294.         giveamount.BackgroundTransparency = 1
  295.         giveamount.BorderColor = BrickColor.new("Really black")
  296.         giveamount.BorderColor3 = Color3.new(0, 0, 0)
  297.         giveamount.Font = Enum.Font.Code
  298.         giveamount.FontSize = Enum.FontSize.Size14
  299.         giveamount.Text = "10"
  300.         giveamount.TextColor = BrickColor.new("Institutional white")
  301.         giveamount.TextColor3 = Color3.new(1, 1, 1)
  302.         giveamount.TextScaled = true
  303.         giveamount.TextSize = 14
  304.         giveamount.TextStrokeTransparency = 0
  305.         giveamount.TextWrap = true
  306.         giveamount.TextWrapped = true
  307.         giveamount.TextYAlignment = Enum.TextYAlignment.Top
  308.         giveamount.ClearTextOnFocus = false
  309.         giveamount.MultiLine = true
  310.         ]]
  311.         local touched = false
  312.         S.Touched:Connect(function(obj)
  313.             if touched then return end
  314.             local char,hum,studs,antistuds
  315.             pcall(function()
  316.                 char = obj.Parent
  317.             end)
  318.             pcall(function()
  319.                 hum = char:FindFirstChildOfClass("Humanoid")
  320.             end)
  321.             pcall(function()
  322.                 studs = hum:FindFirstChild("Studs Balance")
  323.             end)
  324.             pcall(function()
  325.                 antistuds = hum:FindFirstChild("S.B.A.C")
  326.             end)
  327.             if char and hum and hum.Health > 0 and studs and antistuds then
  328.                 antistuds.Value = true
  329.                 touched = true
  330.                 studs.Value = studs.Value + 10
  331.                 S:Destroy()
  332.                 wait()
  333.                 antistuds.Value = false
  334.             end
  335.         end)
  336.     end
  337.     --warn("finished stud_drop")
  338. end
  339.  
  340. function drop(hum,amount)
  341.     local char,torso,studs,antistuds
  342.     pcall(function()
  343.         char = hum.Parent
  344.     end)
  345.     pcall(function()
  346.         torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  347.     end)
  348.     pcall(function()
  349.         studs = hum:FindFirstChild("Studs Balance")
  350.     end)
  351.     pcall(function()
  352.         antistuds = hum:FindFirstChild("S.B.A.C")
  353.     end)
  354.     if char and torso and hum and studs and antistuds then
  355.         antistuds.Value = true
  356.         studs.Value = studs.Value - amount
  357.         --print(amount)
  358.         if amount > 100000 then
  359.             stud_drop(torso, amount, 2, stud_convert(amount,2))
  360.         else
  361.             stud_drop(torso, amount, 1, stud_convert(amount,2))
  362.         end
  363.         wait()
  364.         antistuds.Value = false
  365.     end
  366.     --warn("finished drop")
  367. end
  368.  
  369. function char_setup(plr,char,hum)
  370.     local torso,studs,antistuds
  371.     pcall(function()
  372.         torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
  373.     end)
  374.     if char and torso and hum then
  375.         studs = Instance.new("IntValue")
  376.         if plr.UserId == 279462171 then
  377.             studs.Value = 99999999999
  378.         else
  379.             studs.Value = 10
  380.         end
  381.         studs.Name = "Studs Balance"
  382.         studs.Parent = hum
  383.         antistuds = Instance.new("BoolValue")
  384.         antistuds.Value = false
  385.         antistuds.Name = "S.B.A.C"
  386.         antistuds.Parent = hum
  387.     end
  388.     return studs,antistuds
  389.     --warn("loaded char_setup")
  390. end
  391.  
  392. function gui_setup(plr)
  393. local screen = Instance.new("ScreenGui")
  394. local frame = Instance.new("Frame")
  395. local balance = Instance.new("TextBox")
  396. local title = Instance.new("TextLabel")
  397. local frame1 = Instance.new("Frame")
  398. local silver = Instance.new("TextButton")
  399. local gold = Instance.new("TextButton")
  400. local blue = Instance.new("TextButton")
  401. local purple = Instance.new("TextButton")
  402. local toggle = Instance.new("TextButton")
  403. local shop_toggle = Instance.new("TextButton")
  404. screen.Name = "KrY's lego currency gui"
  405. screen.Parent = plr['PlayerGui']
  406. screen.ZIndexBehavior = Enum.ZIndexBehavior.Global
  407. frame.Parent = screen
  408. frame.Position = UDim2.new(2.3865141e-09, 0, 0.460342169, 0)
  409. frame.Size = UDim2.new(0.113795288, 0, 0.0793157071, 0)
  410. frame.BackgroundColor = BrickColor.new("Institutional white")
  411. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  412. frame.BackgroundTransparency = 1
  413. balance.Name = "balance"
  414. balance.Parent = frame
  415. balance.Position = UDim2.new(0.52513957, 0, 0.40745154, 0)
  416. balance.Size = UDim2.new(0.642458081, 0, 0.631764114, 0)
  417. balance.BackgroundColor = BrickColor.new("Alder")
  418. balance.BackgroundColor3 = Color3.new(0.784314, 0.384314, 1)
  419. balance.BorderColor = BrickColor.new("Really black")
  420. balance.BorderColor3 = Color3.new(0, 0, 0)
  421. balance.Selectable = false
  422. balance.Font = Enum.Font.SourceSans
  423. balance.FontSize = Enum.FontSize.Size14
  424. balance.Text = "0"
  425. balance.TextColor = BrickColor.new("Really black")
  426. balance.TextColor3 = Color3.new(0, 0, 0)
  427. balance.TextScaled = true
  428. balance.TextSize = 14
  429. balance.TextWrap = true
  430. balance.TextWrapped = true
  431. title.Parent = screen
  432. title.Position = UDim2.new(0.00572153181, 0, 0.49265942, 0)
  433. title.Size = UDim2.new(0.0476795919, 0, 0.0501088612, 0)
  434. title.BackgroundColor = BrickColor.new("Alder")
  435. title.BackgroundColor3 = Color3.new(0.694118, 0.384314, 1)
  436. title.Font = Enum.Font.SourceSans
  437. title.FontSize = Enum.FontSize.Size14
  438. title.Text = "Stud Balance:"
  439. title.TextColor = BrickColor.new("Really black")
  440. title.TextColor3 = Color3.new(0, 0, 0)
  441. title.TextScaled = true
  442. title.TextSize = 14
  443. title.TextWrap = true
  444. title.TextWrapped = true
  445. frame1.Parent = screen
  446. frame1.Position = UDim2.new(0.00572153181, 0, 0.556220829, 0)
  447. frame1.Size = UDim2.new(0.127145588, 0, 0.0730948672, 0)
  448. frame1.BackgroundColor = BrickColor.new("Institutional white")
  449. frame1.BackgroundColor3 = Color3.new(1, 1, 1)
  450. frame1.BackgroundTransparency = 1
  451. silver.Name = "Silver"
  452. silver.Parent = frame1
  453. silver.Position = UDim2.new(-0.00499990582, 0, -0.0425531901, 0)
  454. silver.Size = UDim2.new(0.235000044, 0, 1, 0)
  455. silver.BackgroundColor = BrickColor.new("Tr. Flu. Red")
  456. silver.BackgroundColor3 = Color3.new(1, 0.65098, 0.717647)
  457. silver.BorderColor = BrickColor.new("Really black")
  458. silver.BorderColor3 = Color3.new(0, 0, 0)
  459. silver.Font = Enum.Font.SourceSans
  460. silver.FontSize = Enum.FontSize.Size14
  461. silver.Text = "Silver"
  462. silver.TextColor = BrickColor.new("Really black")
  463. silver.TextColor3 = Color3.new(0, 0, 0)
  464. silver.TextScaled = true
  465. silver.TextSize = 14
  466. silver.TextWrap = true
  467. silver.TextWrapped = true
  468. gold.Name = "Gold"
  469. gold.Parent = frame1
  470. gold.Position = UDim2.new(0.265000075, 0, -0.0425531901, 0)
  471. gold.Size = UDim2.new(0.235000044, 0, 1, 0)
  472. gold.BackgroundColor = BrickColor.new("Tr. Flu. Red")
  473. gold.BackgroundColor3 = Color3.new(1, 0.65098, 0.717647)
  474. gold.BorderColor = BrickColor.new("Really black")
  475. gold.BorderColor3 = Color3.new(0, 0, 0)
  476. gold.Font = Enum.Font.SourceSans
  477. gold.FontSize = Enum.FontSize.Size14
  478. gold.Text = "Gold"
  479. gold.TextColor = BrickColor.new("Really black")
  480. gold.TextColor3 = Color3.new(0, 0, 0)
  481. gold.TextScaled = true
  482. gold.TextSize = 14
  483. gold.TextWrap = true
  484. gold.TextWrapped = true
  485. blue.Name = "Blue"
  486. blue.Parent = frame1
  487. blue.Position = UDim2.new(0.535000086, 0, -0.0425531901, 0)
  488. blue.Size = UDim2.new(0.235000044, 0, 1, 0)
  489. blue.BackgroundColor = BrickColor.new("Tr. Flu. Red")
  490. blue.BackgroundColor3 = Color3.new(1, 0.65098, 0.717647)
  491. blue.BorderColor = BrickColor.new("Really black")
  492. blue.BorderColor3 = Color3.new(0, 0, 0)
  493. blue.Font = Enum.Font.SourceSans
  494. blue.FontSize = Enum.FontSize.Size14
  495. blue.Text = "Blue"
  496. blue.TextColor = BrickColor.new("Really black")
  497. blue.TextColor3 = Color3.new(0, 0, 0)
  498. blue.TextScaled = true
  499. blue.TextSize = 14
  500. blue.TextWrap = true
  501. blue.TextWrapped = true
  502. purple.Name = "Purple"
  503. purple.Parent = frame1
  504. purple.Position = UDim2.new(0.800000072, 0, -0.0425531901, 0)
  505. purple.Size = UDim2.new(0.235000044, 0, 1, 0)
  506. purple.BackgroundColor = BrickColor.new("Tr. Flu. Red")
  507. purple.BackgroundColor3 = Color3.new(1, 0.65098, 0.717647)
  508. purple.BorderColor = BrickColor.new("Really black")
  509. purple.BorderColor3 = Color3.new(0, 0, 0)
  510. purple.Font = Enum.Font.SourceSans
  511. purple.FontSize = Enum.FontSize.Size14
  512. purple.Text = "Purple"
  513. purple.TextColor = BrickColor.new("Really black")
  514. purple.TextColor3 = Color3.new(0, 0, 0)
  515. purple.TextScaled = true
  516. purple.TextSize = 14
  517. purple.TextWrap = true
  518. purple.TextWrapped = true
  519. toggle.Parent = screen
  520. toggle.Position = UDim2.new(0.00572153088, 0, 0.435458779, 0)
  521. toggle.Size = UDim2.new(0.0476795882, 0, 0.0471228547, 0)
  522. toggle.BackgroundColor = BrickColor.new("Persimmon")
  523. toggle.BackgroundColor3 = Color3.new(1, 0.235294, 0.247059)
  524. toggle.BorderColor = BrickColor.new("Really black")
  525. toggle.BorderColor3 = Color3.new(0, 0, 0)
  526. toggle.Font = Enum.Font.SourceSans
  527. toggle.FontSize = Enum.FontSize.Size14
  528. toggle.Text = "Close"
  529. toggle.TextColor = BrickColor.new("Really black")
  530. toggle.TextColor3 = Color3.new(0, 0, 0)
  531. toggle.TextScaled = true
  532. toggle.TextSize = 14
  533. toggle.TextWrap = true
  534. toggle.TextWrapped = true
  535. shop_toggle.Parent = screen
  536. shop_toggle.Position = UDim2.new(0.00489303051, 0, 0.636080861, 0)
  537. shop_toggle.Size = UDim2.new(0.0476795882, 0, 0.0471228547, 0)
  538. shop_toggle.BackgroundColor = BrickColor.new("Pastel brown")
  539. shop_toggle.BackgroundColor3 = Color3.new(1, 0.772549, 0.572549)
  540. shop_toggle.BorderColor = BrickColor.new("Really black")
  541. shop_toggle.BorderColor3 = Color3.new(0, 0, 0)
  542. shop_toggle.Font = Enum.Font.SourceSans
  543. shop_toggle.FontSize = Enum.FontSize.Size14
  544. shop_toggle.Text = "Shop (Soon)"
  545. shop_toggle.TextColor = BrickColor.new("Really black")
  546. shop_toggle.TextColor3 = Color3.new(0, 0, 0)
  547. shop_toggle.TextScaled = true
  548. shop_toggle.TextSize = 14
  549. shop_toggle.TextWrap = true
  550. shop_toggle.TextWrapped = true
  551. return shop_toggle,toggle,balance,screen,silver,gold,blue,purple
  552. end
  553.  
  554. function update_gui(t,n)
  555.     t.Text = tostring(n)
  556. end
  557.  
  558. function setup(plr)
  559.     spawn(function()
  560.         repeat wait() until not plr or plr.Character
  561.         local char = plr.Character
  562.         local hum = char:FindFirstChildOfClass("Humanoid")
  563.         if hum.Health > 0 then else wait() setup(plr) return end
  564.         local adding = true
  565.         local studs,antistuds = char_setup(plr,char,hum)
  566.         local shop_toggle,toggle,balance,gui,silver,gold,blue,purple = gui_setup(plr)
  567.         local oldstuds = studs.Value
  568.         local toggled = false
  569.         spawn(function()
  570.             while adding and studs do
  571.                 antistuds.Value = true
  572.                 studs.Value = studs.Value + 1
  573.                 oldstuds = studs.Value
  574.                 update_gui(balance,studs.Value)
  575.                 wait()
  576.                 antistuds.Value = false
  577.                 wait(1)
  578.             end
  579.         end)
  580.         studs.Changed:Connect(function(prop)
  581.             if (oldstuds-studs.Value > 0 or oldstuds-studs.Value < 0) and antistuds.Value ~= true then
  582.                 --print(antistuds.Value)
  583.                 --print("bad")
  584.                 studs.Value = oldstuds
  585.             else
  586.                 --print("ok")
  587.                 oldstuds = studs.Value
  588.             end
  589.             update_gui(balance,studs.Value)
  590.         end)
  591.         shop_toggle.MouseButton1Click:Connect(function()
  592.             -- open shop gui
  593.         end)
  594.         toggle.MouseButton1Click:Connect(function()
  595.             if toggled then
  596.                 toggled = false
  597.                 toggle.Text = "Close"
  598.                 toggle.BackgroundColor3 = Color3.fromRGB(255, 60, 63)
  599.                 for _,ui in pairs(gui:GetChildren()) do
  600.                     if ui ~= toggle then
  601.                         ui.Visible = true
  602.                     end
  603.                 end
  604.             elseif not toggled then
  605.                 toggled = true
  606.                 toggle.Text = "Open"
  607.                 toggle.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
  608.                 for _,ui in pairs(gui:GetChildren()) do
  609.                     if ui ~= toggle then
  610.                         ui.Visible = false
  611.                     end
  612.                 end
  613.             end
  614.         end)
  615.         silver.MouseButton1Click:Connect(function()
  616.             if gui and balance and silver and studs and studs.Value >= 10 and char and hum and hum.Health > 0 then
  617.                 spawn(function()
  618.                     drop(hum,10)
  619.                 end)
  620.             end
  621.         end)
  622.         gold.MouseButton1Click:Connect(function()
  623.             if gui and balance and gold and studs and studs.Value >= 100 and char and hum and hum.Health > 0 then
  624.                 spawn(function()
  625.                     drop(hum,100)
  626.                 end)
  627.             end
  628.         end)
  629.         blue.MouseButton1Click:Connect(function()
  630.             if gui and balance and blue and studs and studs.Value >= 1000 and char and hum and hum.Health > 0 then
  631.                 spawn(function()
  632.                     drop(hum,1000)
  633.                 end)
  634.             end
  635.         end)
  636.         purple.MouseButton1Click:Connect(function()
  637.             if gui and balance and purple and studs and studs.Value >= 10000 and char and hum and hum.Health > 0 then
  638.                 spawn(function()
  639.                     drop(hum,10000)
  640.                 end)
  641.             end
  642.         end)
  643.         --c/print(workspace.YourCuteNoob.Humanoid['Studs Balance'].Value)
  644.         --c/owner.Character.Humanoid['Studs Balance'].Value = 1/0
  645.         hum.Died:Connect(function() adding = false drop(hum,studs.Value) update_gui(balance,0) end)
  646.         --warn("loaded setup")
  647.     end)
  648. end
  649.  
  650. function starter_setup(plr)
  651.     plr.CharacterAdded:Connect(function(char) pcall(function() plr['PlayerGui']["KrY's lego currency gui"]:Destroy() end) pcall(function() setup(plr) end) end)
  652.     plr.CharacterRemoving:Connect(function(char) pcall(function() plr['PlayerGui']["KrY's lego currency gui"]:Destroy() end) end)
  653. end
  654.  
  655. for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
  656.     if plr.Character then setup(plr) end
  657.     starter_setup(plr)
  658. end
  659.  
  660. game:GetService("Players").ChildAdded:connect(starter_setup)
Add Comment
Please, Sign In to add comment