Advertisement
BobMe

Button

Mar 14th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. --Converted with ttyyuu12345's model to script plugin v4
  2. function sandbox(var,func)
  3. local env = getfenv(func)
  4. local newenv = setmetatable({},{
  5. __index = function(self,k)
  6. if k=="script" then
  7. return var
  8. else
  9. return env[k]
  10. end
  11. end,
  12. })
  13. setfenv(func,newenv)
  14. return func
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. Part0 = Instance.new("Part")
  19. SurfaceGui1 = Instance.new("SurfaceGui")
  20. TextButton2 = Instance.new("TextButton")
  21. Script3 = Instance.new("Script")
  22. Part0.Name = "Click me :D"
  23. Part0.Parent = mas
  24. Part0.Anchored = true
  25. Part0.Size = Vector3.new(19.8299961, 15.9699993, 2)
  26. Part0.CFrame = CFrame.new(21.4750061, 7.98500347, -15.1499996, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  27. Part0.BottomSurface = Enum.SurfaceType.Smooth
  28. Part0.TopSurface = Enum.SurfaceType.Smooth
  29. Part0.Position = Vector3.new(21.4750061, 7.98500347, -15.1499996)
  30. SurfaceGui1.Parent = Part0
  31. SurfaceGui1.Face = Enum.NormalId.Back
  32. TextButton2.Parent = SurfaceGui1
  33. TextButton2.Size = UDim2.new(0, 395, 0, 374)
  34. TextButton2.Text = "This button has been clicked 0 times!"
  35. TextButton2.Position = UDim2.new(0, 223, 0, 101)
  36. TextButton2.BackgroundColor3 = Color3.new(1, 0, 0.901961)
  37. TextButton2.Font = Enum.Font.SourceSans
  38. TextButton2.FontSize = Enum.FontSize.Size96
  39. TextButton2.TextScaled = true
  40. TextButton2.TextWrapped = true
  41. Script3.Parent = TextButton2
  42. table.insert(cors,sandbox(Script3,function()
  43. click = 0
  44. function onClick(plyr)
  45. click = click+1
  46. print(click)
  47. script.Parent.Text = ("This button has been clicked {{{" .. click .. "}}} times!")
  48.  
  49. end
  50.  
  51. script.Parent.MouseButton1Down:connect(onClick)
  52.  
  53.  
  54. end))
  55. for i,v in pairs(mas:GetChildren()) do
  56. v.Parent = script
  57. pcall(function() v:MakeJoints() end)
  58. end
  59. mas:Destroy()
  60. for i,v in pairs(cors) do
  61. spawn(function()
  62. pcall(v)
  63. end)
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement