Advertisement
bmrx13

gamble

Jun 15th, 2018
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.05 KB | None | 0 0
  1.  
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code by Mokiros")
  7. local rp = RealPlayer
  8. script.Parent = rp.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent then
  34. for _,f in pairs(t.Functions) do
  35. f(...)
  36. end
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=rp then return end
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. if not io.isMouse then
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  52. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  53. end
  54. for _,t in pairs(CAS.Actions) do
  55. for _,k in pairs(t.Keys) do
  56. if k==io.KeyCode then
  57. t.Function(t.Name,io.UserInputState,io)
  58. end
  59. end
  60. end
  61. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  62. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  63. end
  64. end)
  65. Event.Parent = NLS([==[
  66. local Player = game:GetService("Players").LocalPlayer
  67. local Event = script:WaitForChild("UserInput_Event")
  68.  
  69. local Mouse = Player:GetMouse()
  70. local UIS = game:GetService("UserInputService")
  71. local input = function(io,a)
  72. if a then return end
  73. --Since InputObject is a client-side instance, we create and pass table instead
  74. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  75. end
  76. UIS.InputBegan:Connect(input)
  77. UIS.InputEnded:Connect(input)
  78.  
  79. local h,t
  80. --Give the server mouse data 30 times every second, but only if the values changed
  81. --If player is not moving their mouse, client won't fire events
  82. while wait(1/30) do
  83. if h~=Mouse.Hit or t~=Mouse.Target then
  84. h,t=Mouse.Hit,Mouse.Target
  85. Event:FireServer({isMouse=true,Target=t,Hit=h})
  86. end
  87. end]==],Player.Character)
  88.  
  89. ----Sandboxed game object that allows the usage of client-side methods and services
  90. --Real game object
  91. local _rg = game
  92.  
  93. --Metatable for fake service
  94. local fsmt = {
  95. __index = function(self,k)
  96. local s = rawget(self,"_RealService")
  97. if s then
  98. return typeof(s[k])=="function"
  99. and function(_,...)return s[k](s,...)end or s[k]
  100. end
  101. end,
  102. __newindex = function(self,k,v)
  103. local s = rawget(self,"_RealService")
  104. if s then s[k]=v end
  105. end
  106. }
  107. local function FakeService(t,RealService)
  108. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  109. return setmetatable(t,fsmt)
  110. end
  111.  
  112. --Fake game object
  113. local g = {
  114. GetService = function(self,s)
  115. return rawget(self,s) or _rg:GetService(s)
  116. end,
  117. Players = FakeService({
  118. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  119. },"Players"),
  120. UserInputService = FakeService(UIS,"UserInputService"),
  121. ContextActionService = FakeService(CAS,"ContextActionService"),
  122. RunService = FakeService({
  123. _btrs = {},
  124. RenderStepped = _rg:GetService("RunService").Heartbeat,
  125. BindToRenderStep = function(self,name,_,fun)
  126. self._btrs[name] = self.Heartbeat:Connect(fun)
  127. end,
  128. UnbindFromRenderStep = function(self,name)
  129. self._btrs[name]:Disconnect()
  130. end,
  131. },"RunService")
  132. }
  133. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  134. g.service = g.GetService
  135. FakeService(g,game)
  136. --Changing owner to fake player object to support owner:GetMouse()
  137. game,owner = g,g.Players.LocalPlayer
  138. end
  139.  
  140. me = game.Players.LocalPlayer.Character.Torso
  141. name = "xSoul's Machine"
  142. mainpos = Vector3.new(me.Position.X + 10,0.3,me.Position.Z)
  143. maxdist = 7
  144. imgs = {"http://www.roblox.com/asset/?id=43267871","http://www.roblox.com/asset/?id=43267737",
  145. "http://www.roblox.com/asset/?id=43267826","http://www.roblox.com/asset/?id=43267704",
  146. "http://www.roblox.com/asset/?id=43267858"}
  147.  
  148. a = imgs[1]
  149. b = imgs[2]
  150. c = imgs[3]
  151. d = imgs[4]
  152. e = imgs[5]
  153.  
  154. give = true
  155. function givestats(player)
  156. local stat = Instance.new("IntValue")
  157. stat.Name = "leaderstats"
  158. local tix = Instance.new("IntValue")
  159. tix.Name = "Tix"
  160. tix.Value = 25
  161. tix.Parent = stat
  162. stat.Parent = player
  163. end
  164. for _,v in pairs(game.Players:GetPlayers()) do
  165. if v:findFirstChild("leaderstats") == nil then
  166. givestats(v)
  167. end
  168. end
  169. game.Players.PlayerAdded:connect(function(plyr) if give then givestats(plyr) end end)
  170.  
  171. function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  172. part.Parent = parent
  173. part.formFactor = form
  174. part.CanCollide = collide
  175. part.Transparency = tran
  176. part.Reflectance = ref
  177. part.Size = Vector3.new(x,y,z)
  178. part.BrickColor = BrickColor.new(color)
  179. part.TopSurface = 0
  180. part.BottomSurface = 0
  181. part.Anchored = anchor
  182. part.Locked = true
  183. part:BreakJoints()
  184. end
  185.  
  186. function weld(w, p, p1, a, b, c, x, y, z)
  187. w.Parent = p
  188. w.Part0 = p
  189. w.Part1 = p1
  190. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  191. end
  192.  
  193. dings = {}
  194.  
  195. function getplyr(pos)
  196. local dist = maxdist
  197. local plyr = nil
  198. for _,v in pairs(game.Players:GetPlayers()) do
  199. if v.Character ~= nil then
  200. local to = v.Character:findFirstChild("Torso")
  201. if to ~= nil then
  202. if (to.Position - pos).magnitude < dist then
  203. dist = (to.Position - pos).magnitude
  204. plyr = v
  205. end
  206. end
  207. end
  208. end
  209. return plyr
  210. end
  211.  
  212. function reward(first,second,third,mod,pos,play)
  213. local k = 0
  214. if first.Texture == a and second.Texture == a and third.Texture == a then
  215. k = 3
  216. elseif first.Texture == b and second.Texture == b and third.Texture == b then
  217. k = 5
  218. elseif first.Texture == c and second.Texture == c and third.Texture == c then
  219. k = 8
  220. elseif first.Texture == d and second.Texture == d and third.Texture == d then
  221. k = 25
  222. elseif first.Texture == e and second.Texture == e and third.Texture == e then
  223. k = 75
  224. elseif first.Texture == d and second.Texture == d or third.Texture == d and second.Texture == d or third.Texture == d and first.Texture == d then
  225. k = 14
  226. elseif first.Texture == e and second.Texture == e or third.Texture == e and second.Texture == e or third.Texture == e and first.Texture == e then
  227. k = 35
  228. end
  229. for i=1,k do
  230. wait()
  231. local t = Instance.new("Part")
  232. prop(t, mod, true, 0, 0, 0.6, 0.1, 0.3, "Bright yellow", false, "Custom")
  233. t.CFrame = CFrame.new(pos + Vector3.new(math.random(-100,100)/100,0,math.random(-50,50)/100)) * CFrame.Angles(0,math.random(-32,32)/10,0)
  234. local dec = Instance.new("Decal",t)
  235. dec.Face = "Top"
  236. dec.Texture = "http://www.roblox.com/asset/?id=42602113"
  237. local de2 = dec:clone()
  238. de2.Parent = t
  239. de2.Face = "Bottom"
  240. local de = true
  241. coroutine.resume(coroutine.create(function()
  242. wait(23)
  243. t:remove()
  244. end))
  245. t.Touched:connect(function(hit)
  246. if de then
  247. if hit.Parent.Name == play.Name then
  248. local sta = play:findFirstChild("leaderstats")
  249. if sta ~= nil then
  250. local tx = sta:findFirstChild("Tix")
  251. if tx ~= nil then
  252. de = false
  253. tx.Value = tx.Value + 1
  254. t:remove()
  255. end
  256. end
  257. end
  258. end
  259. end)
  260. end
  261. end
  262.  
  263. local lol = workspace:findFirstChild(name)
  264. if lol ~= nil then
  265. lol:remove()
  266. end
  267.  
  268. machine = Instance.new("Model",workspace.Base)
  269. machine.Name = name
  270.  
  271. mainpart = Instance.new("Part")
  272. prop(mainpart,machine,true,0,0,5.7,9,5.1,"Bright red",true,"Custom")
  273. mainpart.CFrame = CFrame.new(mainpos) * CFrame.new(0,mainpart.Size.Y/2,0)
  274.  
  275. dec1 = Instance.new("Part")
  276. prop(dec1,machine,true,0,0,5,9.1,4.3,"Black",true,"Custom")
  277. dec1.CFrame = mainpart.CFrame
  278.  
  279. dec2 = Instance.new("Part")
  280. prop(dec2,machine,true,0,0,5,8.4,5.2,"Black",true,"Custom")
  281. dec2.CFrame = mainpart.CFrame
  282.  
  283. dec3 = Instance.new("Part")
  284. prop(dec3,machine,true,0,0,5.8,8.4,4.3,"Black",true,"Custom")
  285. dec3.CFrame = mainpart.CFrame
  286.  
  287. vend1 = Instance.new("Part")
  288. prop(vend1,machine,true,0,0,1.8,1.8,1.8,"Bright red",true,"Custom")
  289. vend1.CFrame = mainpart.CFrame * CFrame.new(-3.2,0,1.2)
  290. Instance.new("SpecialMesh",vend1).MeshType = "Sphere"
  291.  
  292. vend2 = Instance.new("Part")
  293. prop(vend2,machine,true,0,0,0.7,3.5,0.7,"Black",true,"Custom")
  294. vend2.CFrame = vend1.CFrame * CFrame.new(-0.3,2.3,0)
  295. Instance.new("SpecialMesh",vend2)
  296.  
  297. vend3 = Instance.new("Part")
  298. prop(vend3,machine,true,0,0,1.3,1.3,1.3,"Bright red",true,"Custom")
  299. vend3.CFrame = vend2.CFrame * CFrame.new(0,1.8,0)
  300. Instance.new("SpecialMesh",vend3).MeshType = "Sphere"
  301.  
  302. click = Instance.new("ClickDetector",vend1)
  303. click.MaxActivationDistance = maxdist
  304. click.Name = "ClickHere"
  305. abletoclick = true
  306.  
  307. for i=-180,-70,15 do
  308. local part = Instance.new("Part")
  309. prop(part,machine,false,0,0,3,0.4,0.1,"Black",true,"Custom")
  310. part.CFrame = mainpart.CFrame * CFrame.new(1.1,-1,2.8) * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-1)
  311. table.insert(dings,part)
  312. for o=-1.5,1.5,3 do
  313. local part2 = Instance.new("Part")
  314. prop(part2,machine,false,0,0,0.1,0.4,1.2,"Bright red",true,"Custom")
  315. part2.CFrame = part.CFrame * CFrame.new(o,0,part2.Size.Z/2)
  316. end
  317. end
  318.  
  319. things = {}
  320. for i= -1.5, 1.5, 1.5 do
  321. local thing1 = Instance.new("Part")
  322. prop(thing1,machine,true,0,0,1.5,1,1.5,"White",true,"Custom")
  323. thing1.CFrame = mainpart.CFrame * CFrame.new(i,2,2.3) * CFrame.Angles(0,0,-math.pi/2)
  324. Instance.new("CylinderMesh",thing1)
  325. local dec = Instance.new("Decal",thing1)
  326. dec.Face = "Back"
  327. dec.Texture = imgs[1]
  328. table.insert(things,thing1)
  329. end
  330. on = things[1]
  331. sec = things[2]
  332. thi = things[3]
  333.  
  334. click.MouseClick:connect(function()
  335. if abletoclick == true then
  336. local player = getplyr(vend1.Position)
  337. if player ~= nil then
  338. local sta = player:findFirstChild("leaderstats")
  339. if sta ~= nil then
  340. local tc = sta:findFirstChild("Tix")
  341. if tc ~= nil then
  342. tc.Value = tc.Value - 4
  343. end
  344. end
  345. if abletoclick == true then
  346. abletoclick = false
  347. local bp = Instance.new("BodyPosition",player.Character.Torso)
  348. local to = bp.Parent
  349. local larm = to:findFirstChild("Left Shoulder")
  350. bp.P = 15000
  351. bp.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  352. bp.position = mainpart.CFrame * CFrame.new(-2,-1,4).p
  353. local bg = Instance.new("BodyGyro",player.Character.Torso)
  354. bg.P = 15000
  355. bg.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  356. bg.cframe = CFrame.new(to.Position, vend1.Position - Vector3.new(0,0.8,0))
  357. wait(0.4)
  358. bg.cframe = CFrame.new(to.Position, vend1.Position - Vector3.new(0,0.8,0))
  359. local orig = nil
  360. if larm ~= nil then
  361. orig = larm.C0
  362. for i=0, 3, 0.4 do
  363. larm.C0 = orig * CFrame.fromEulerAnglesXYZ(0,0,-i)
  364. wait()
  365. end
  366. wait(0.1)
  367. else
  368. wait(0.2)
  369. end
  370. for i=0, 1.3, 0.15 do
  371. wait()
  372. vend2.CFrame = vend1.CFrame * CFrame.Angles(i,0,0) * CFrame.new(-0.3,2.3,0)
  373. vend3.CFrame = vend2.CFrame * CFrame.new(0,1.8,0)
  374. if larm ~= nil then
  375. larm.C0 = larm.C0 * CFrame.fromEulerAnglesXYZ(0,0,0.3)
  376. end
  377. end
  378. if larm ~= nil then
  379. larm.C0 = orig
  380. end
  381. wait(0.2)
  382. for i=1.3, 0, -0.3 do
  383. wait()
  384. vend2.CFrame = vend1.CFrame * CFrame.Angles(i,0,0) * CFrame.new(-0.3,2.3,0)
  385. vend3.CFrame = vend2.CFrame * CFrame.new(0,1.8,0)
  386. end
  387. bp.position = mainpart.CFrame * CFrame.new(0,-1,5.5).p
  388. bg.cframe = CFrame.new(to.Position, mainpart.Position)
  389. coroutine.resume(coroutine.create(function()
  390. wait(0.6)
  391. bg.cframe = CFrame.new(to.Position, mainpart.Position)
  392. end))
  393. for o=1,math.random(60,160) do
  394. local he = math.random(1,5)
  395. local he1 = math.random(1,5)
  396. local he2 = math.random(1,5)
  397. on.Decal.Texture = imgs[he]
  398. sec.Decal.Texture = imgs[he1]
  399. thi.Decal.Texture = imgs[he2]
  400. wait()
  401. end
  402. reward(on.Decal,sec.Decal,thi.Decal,machine,mainpart.CFrame * CFrame.new(1.1,-0.9,3).p,player)
  403. bp:remove()
  404. bg:remove()
  405. wait(1)
  406. abletoclick = true
  407. end
  408. end
  409. end
  410. end)
  411.  
  412. game.Players.IwasVivedVenom2.Chatted:connect(function(msg)
  413. if msg == "leader" then
  414. give = false
  415. for _,v in pairs(game.Players:GetPlayers()) do
  416. if v:findFirstChild("leaderstats") ~= nil then
  417. v.leaderstats:remove()
  418. end
  419. end
  420. end
  421. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement