yoyo74456

Clicker Game

Sep 6th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.13 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Please run as a server script. Use h/ instead of hl/.") end
  2. InternalData = {}
  3. do
  4. script.Parent = owner.Character
  5. local Event = Instance.new("RemoteEvent")
  6. Event.Name = "UserInput"
  7. local function NewFakeEvent()
  8. local Fake = {fakeEvent=true,Connect=function(self,Func)self.Function=Func end}Fake.connect = Fake.Connect
  9. return Fake
  10. end
  11. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  12. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  13. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  14. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  15. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  16. local function TriggerEvent(self,Event,...)
  17. local Trigger = Mouse[Event]
  18. if Trigger and Trigger.fakeEvent and Trigger.Function then
  19. Trigger.Function(...)
  20. end
  21. end
  22. Mouse.TrigEvent = TriggerEvent
  23. UserInputService.TrigEvent = TriggerEvent
  24. Event.OnServerEvent:Connect(function(FiredBy,Input)
  25. if FiredBy.Name ~= owner.Name then end
  26. if Input.MouseEvent then
  27. Mouse.Target = Input.Target
  28. Mouse.Hit = Input.Hit
  29. else
  30. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  31. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  32. return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up")
  33. end
  34. for _,Action in pairs(ContextActionService.Actions) do
  35. for _,Key in pairs(Action.Keys) do
  36. if Key==Input.KeyCode then
  37. Action.Function(Action.Name,Input.UserInputState,Input)
  38. end
  39. end
  40. end
  41. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  42. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  43. end
  44. end)
  45. InternalData["Mouse"] = Mouse
  46. InternalData["ContextActionService"] = ContextActionService
  47. InternalData["UserInputService"] = UserInputService
  48. Event.Parent = NLS([[
  49. local Player = owner
  50. local Event = script:WaitForChild("UserInput")
  51. local UserInputService = game:GetService("UserInputService")
  52. local Mouse = Player:GetMouse()
  53. local Input = function(Input,gameProcessedEvent)
  54. if gameProcessedEvent then return end
  55. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  56. end
  57. UserInputService.InputBegan:Connect(Input)
  58. UserInputService.InputEnded:Connect(Input)
  59. local Hit,Target
  60. while wait(1/30) do
  61. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  62. Hit,Target = Mouse.Hit,Mouse.Target
  63. Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  64. end
  65. end
  66. ]],owner.Character)
  67. end
  68. RealGame = game;game = setmetatable({},{
  69. __index = function (self,Index)
  70. local Sandbox = function (Thing)
  71. if Thing:IsA("Player") then
  72. local RealPlayer = Thing
  73. return setmetatable({},{
  74. __index = function (self,Index)
  75. local Type = type(RealPlayer[Index])
  76. if Type == "function" then
  77. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  78. return function (self)
  79. return InternalData["Mouse"]
  80. end
  81. end
  82. return function (self,...)
  83. return RealPlayer[Index](RealPlayer,...)
  84. end
  85. else
  86. if Index == "PlrObj" then
  87. return RealPlayer
  88. end
  89. return RealPlayer[Index]
  90. end
  91. end;
  92. __tostring = function(self)
  93. return RealPlayer.Name
  94. end
  95. })
  96. end
  97. end
  98. if RealGame[Index] then
  99. local Type = type(RealGame[Index])
  100. if Type == "function" then
  101. if Index:lower() == "getservice" or Index:lower() == "service" then
  102. return function (self,Service)
  103. if Service:lower() == "players" then
  104. return setmetatable({},{
  105. __index = function (self2,Index2)
  106. local RealService = RealGame:GetService(Service)
  107. local Type2 = type(Index2)
  108. if Type2 == "function" then
  109. return function (self,...)
  110. return RealService[Index2](RealService,...)
  111. end
  112. else
  113. if Index2:lower() == "localplayer" then
  114. return Sandbox(owner)
  115. end
  116. return RealService[Index2]
  117. end
  118. end;
  119. __tostring = function(self)
  120. return RealGame:GetService(Service).Name
  121. end
  122. })
  123. elseif Service:lower() == "contextactionservice" then
  124. return InternalData["ContextActionService"]
  125. elseif Service:lower() == "contextactionservice" then
  126. return InternalData["UserInputService"]
  127. elseif Service:lower() == "runservice" then
  128. return setmetatable({},{
  129. __index = function(self2,Index2)
  130. local RealService = RealGame:GetService(Service)
  131. local Type2 = type(Index2)
  132. if Type2 == "function" then
  133. return function (self,...)
  134. return RealService[Index2](RealService,...)
  135. end
  136. else
  137. if Index2:lower() == "bindtorenderstep" then
  138. return function (self,Name,Priority,Function)
  139. return RealGame:GetService("RunService").Stepped:Connect(Function)
  140. end
  141. end
  142. if Index2:lower() == "renderstepped" then
  143. return RealService["Stepped"]
  144. end
  145. return RealService[Index2]
  146. end
  147. end
  148. })
  149. else
  150. return RealGame:GetService(Service)
  151. end
  152. end
  153. end
  154. return function (self,...)
  155. return RealGame[Index](RealGame,...)
  156. end
  157. else
  158. if game:GetService(Index) then
  159. return game:GetService(Index)
  160. end
  161. return RealGame[Index]
  162. end
  163. else
  164. return nil
  165. end
  166. end
  167. });Game = game;owner = game:GetService("Players").LocalPlayer;script = {}
  168. print("Complete! Running...")
  169.  
  170. wait(2)
  171. Player = game:GetService("Players").LocalPlayer
  172. Char = Player.Character
  173. CurLevel = 0
  174. CurClicks = 0
  175. MaxClicks = 10
  176.  
  177. SG = Instance.new("ScreenGui", Player.PlayerGui)
  178. F = Instance.new("Frame", SG)
  179. F.BackgroundTransparency = 1
  180. F.Position = UDim2.new(1,-200,1,-50)
  181. F.Size = UDim2.new(0,200,0,50)
  182. TB = Instance.new("TextButton", F)
  183. TB.BackgroundTransparency = 0.7
  184. TB.BorderSizePixel = 0
  185. TB.Size = UDim2.new(1,0,1,0)
  186. TB.Font = "Code"
  187. TB.Text = "Click me!"
  188. TB.TextScaled = true
  189.  
  190. Bg = Instance.new("BillboardGui", Char.Head)
  191. Bg.MaxDistance = 80
  192. Bg.Size = UDim2.new(6, 0, 2, 0)
  193. Bg.StudsOffset = Vector3.new(0, 2.5, 0)
  194. Lvl = Instance.new("TextLabel", Bg)
  195. Lvl.BackgroundTransparency = 1
  196. Lvl.Size = UDim2.new(1, 0, .5, 0)
  197. Lvl.Position = UDim2.new(0,0,0.5,0)
  198. Lvl.Font = "Code"
  199. Lvl.Text = "Level : "..CurLevel
  200. Lvl.TextScaled = true
  201. Lvl.TextWrapped = true
  202. Lvl.TextColor3 = Color3.fromRGB(52, 154, 217)
  203. Clicks = Instance.new("TextLabel", Bg)
  204. Clicks.BackgroundTransparency = 1
  205. Clicks.Size = UDim2.new(1, 0, .5, 0)
  206. Clicks.Position = UDim2.new(0,0,0,0)
  207. Clicks.Font = "Code"
  208. Clicks.Text = "Clicks : "..CurClicks.."/"..MaxClicks
  209. Clicks.TextScaled = true
  210. Clicks.TextWrapped = true
  211. Clicks.TextColor3 = Color3.fromRGB(255, 124, 174)
  212.  
  213. TB.MouseButton1Click:connect(function()
  214. CurClicks = CurClicks + 1
  215. Clicks.Text = "Clicks : "..CurClicks.."/"..MaxClicks
  216. if CurClicks >= MaxClicks then
  217. MaxClicks = MaxClicks * 1.5
  218. CurClicks = 0
  219. CurLevel = CurLevel + 1
  220. if CurLevel >= 0 then
  221. Lvl.Text = "Level : Noob"
  222. end
  223. if CurLevel >= 2 then
  224. Lvl.Text = "Level : Poor"
  225. end
  226. if CurLevel >= 4 then
  227. Lvl.Text = "Level : Mediocre"
  228. end
  229. if CurLevel >= 6 then
  230. Lvl.Text = "Level : Competent"
  231. end
  232. if CurLevel >= 9 then
  233. Lvl.Text = "Level : Experienced"
  234. end
  235. if CurLevel >= 15 then
  236. Lvl.Text = "Level : Elite"
  237. end
  238. if CurLevel >= 23 then
  239. Lvl.Text = " Entropia Master"
  240. end
  241. end
  242. end)
Add Comment
Please, Sign In to add comment