cat568

Untitled

Dec 29th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --just put this on the top of a script and boom 89% works
  2. --note this does not work on big scripts
  3. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  4. local Player,game,owner = owner,game
  5. local RealPlayer = Player
  6. do
  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()}
  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. for _,t in pairs(CAS.Actions) do
  52. for _,k in pairs(t.Keys) do
  53. if k==io.KeyCode then
  54. t.Function(t.Name,io.UserInputState,io)
  55. end
  56. end
  57. end
  58. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  59. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  60. end
  61. end)
  62. Event.Parent = NLS([==[
  63. local Player = game:GetService("Players").LocalPlayer
  64. local Event = script:WaitForChild("UserInput_Event")
  65.  
  66. local Mouse = Player:GetMouse()
  67. local UIS = game:GetService("UserInputService")
  68. local input = function(io,a)
  69. if a then return end
  70. --Since InputObject is a client-side instance, we create and pass table instead
  71. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  72. end
  73. UIS.InputBegan:Connect(input)
  74. UIS.InputEnded:Connect(input)
  75.  
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then return s[k] end
  95. end,
  96. __newindex = function(self,k,v)
  97. local s = rawget(self,"_RealService")
  98. if s then s[k]=v end
  99. end,
  100. __call = function(self,...)
  101. local s = rawget(self,"_RealService")
  102. if s then return s(...) end
  103. end
  104. }
  105. local function FakeService(t,RealService)
  106. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  107. return setmetatable(t,fsmt)
  108. end
  109.  
  110. --Fake game object
  111. local g = {
  112. GetService = function(self,s)
  113. return self[s]
  114. end,
  115. Players = FakeService({
  116. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  117. },"Players"),
  118. UserInputService = FakeService(UIS,"UserInputService"),
  119. ContextActionService = FakeService(CAS,"ContextActionService"),
  120. }
  121. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  122. g.service = g.GetService
  123.  
  124. g.RunService = FakeService({
  125. RenderStepped = _rg:GetService("RunService").Heartbeat,
  126. BindToRenderStep = function(self,name,_,fun)
  127. self._btrs[name] = self.Heartbeat:Connect(fun)
  128. end,
  129. UnbindFromRenderStep = function(self,name)
  130. self._btrs[name]:Disconnect()
  131. end,
  132. },"RunService")
  133.  
  134. setmetatable(g,{
  135. __index=function(self,s)
  136. return _rg:GetService(s) or typeof(_rg[s])=="function"
  137. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  138. end,
  139. __newindex = fsmt.__newindex,
  140. __call = fsmt.__call
  141. })
  142. --Changing owner to fake player object to support owner:GetMouse()
  143. game,owner = g,g.Players.LocalPlayer
  144. end
  145.  
  146.  
  147.  
  148. -- Gas
  149. -- By : jarredbcv
  150. -- Fire spread by : samfun123
  151.  
  152. lp = game.Players.LocalPlayer
  153. pl = lp.Character
  154. tol = Instance.new("HopperBin",lp.Backpack)
  155. tol.Name = "Gas"
  156. burn = {}
  157. burning = {}
  158. colr={"Neon orange","Black","White","Bright yellow","Bright red","Bright blue","Bright green","Really black","Royal purple","Magenta","Pink"}
  159. col="Neon orange"
  160. Part = function(x,y,z,color,tr,cc,an,parent)
  161. local p = Instance.new('Part',parent or Weapon)
  162. p.formFactor = 'Custom'
  163. p.Size = Vector3.new(x,y,z)
  164. p.BrickColor = BrickColor.new(color)
  165. p.CanCollide = cc
  166. p.Transparency = tr
  167. p.Anchored = an
  168. p.TopSurface,p.BottomSurface = 0,0
  169. return p
  170. end
  171.  
  172. fir = function(parent)
  173. local fi = Instance.new('Fire',parent or Weapon)
  174. fi.Name = "Fire"
  175. table.insert(burning,parent)
  176. game.Debris:AddItem(parent,2)
  177. if parent.Name ~= "Match" then
  178. fi.Color=parent.BrickColor.Color
  179. function touch(hit)
  180. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  181. if hit.Parent.Name==pl.Name then return end
  182. hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health - 10
  183. end
  184. end
  185. parent.Touched:connect(touch)
  186. end
  187. return fi
  188. end
  189.  
  190. Weld = function(p0,p1,x,y,z,rx,ry,rz,par)
  191. p0.Position = p1.Position
  192. local w = Instance.new('Motor',par or p0)
  193. w.Part0 = p0
  194. w.Part1 = p1
  195. w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz)
  196. return w
  197. end
  198.  
  199. Mesh = function(par,num,x,y,z)
  200. local msh = _
  201. if num == 1 then
  202. msh = Instance.new("CylinderMesh",par)
  203. elseif num == 2 then
  204. msh = Instance.new("SpecialMesh",par)
  205. msh.MeshType = 3
  206. elseif num == 3 then
  207. msh = Instance.new("BlockMesh",par)
  208. elseif type(num) == 'string' then
  209. msh = Instance.new("SpecialMesh",par)
  210. msh.MeshId = num
  211. end
  212. msh.Scale = Vector3.new(x,y,z)
  213. return msh
  214. end
  215.  
  216. mo=Instance.new("Model",pl)
  217. function throw()
  218. hot=false
  219. for i = 1,10 do
  220. wait()
  221. fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i))
  222. end
  223. mtch = Part(.2,.1,.2,'Black',0,true,false,mo)
  224. mtch:BreakJoints()
  225. mtch.Name = "Match"
  226. mtch.CFrame=pl["Left Arm"].CFrame + Vector3.new(.5,0,0)
  227. fir(mtch)
  228. game.Debris:AddItem(mtch,1)
  229. function touch(hit)
  230. if hit.Name=="veryhotfire" and hit:FindFirstChild("Fire") == nil then
  231. fir(hit)
  232. end
  233. end
  234. mtch.Touched:connect(touch)
  235. fakel2.C0=crnt
  236. end
  237.  
  238. function pour()
  239. brek=false
  240. while wait() do
  241. if brek==true then break end
  242. liq = Part(2,.1,2,col,.9,false,true,workspace)
  243. m = Mesh(liq,1,1,1,1)
  244. liq.CFrame = CFrame.new(por.CFrame.x,por.CFrame.y,por.CFrame.z)-Vector3.new(0,.4,0)
  245. liq.Name = "veryhotfire"
  246. end
  247. end
  248.  
  249. function depour()
  250. brek=true
  251. end
  252. num=0
  253. function onKeyDown(key)
  254. key = key:lower()
  255. if key == "e" then
  256. throw()
  257. elseif key == "q" then
  258. for i = 1,10 do
  259. wait()
  260. fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i))
  261. end
  262. box = Part(1,2,1,'Bright red',0,true,false,workspace)
  263. box.Material="CorrodedMetal"
  264. box:BreakJoints()
  265. m=Mesh(box,1,1,1,1)
  266. box.Name = "Crate"
  267. box.CFrame=pl["Left Arm"].CFrame + Vector3.new(1,0,0)*CFrame.Angles(0,0,math.pi/2)
  268. fakel2.C0=crnt
  269. elseif key == "r" then
  270. num=num+1
  271. col=colr[num]
  272. por.BrickColor=BrickColor.new(col)
  273. Spawn(function()
  274. tol.Name=col
  275. wait(1)
  276. tol.Name="Gas"
  277. end)
  278. if num==11 then num=0 end
  279. end
  280. end
  281. function onClicked(mouse)
  282. for i=1,10 do
  283. wait()
  284. mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-i/10,-math.pi/2,math.pi/2)
  285. end
  286. por.Transparency=0.4
  287. pour()
  288. end
  289. function deClicked(mouse)
  290. for i=1,10 do wait()
  291. mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-1+i/10,-math.pi/2,math.pi/2)
  292. por.Transparency=1
  293. depour()
  294. end
  295. end
  296.  
  297. mpa= Part(1.25,1.5,.6,'Really red',0,false,false,mo)
  298. mwl= Weld(mpa,pl.Torso,0,0,.8,0,0,0,mo)
  299. pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
  300. wl= Weld(pa,mpa,.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
  301. pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
  302. wl= Weld(pa,mpa,-.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
  303. pa= Part(.3,.3,.3,'Dark stone grey',0,false,false,mo)
  304. wl= Weld(pa,mpa,-.4,.75,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
  305. pa= Part(.2,.3,.2,'',0,false,false,mo)
  306. wl= Weld(pa,mpa,-.4,1,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
  307. noz= Part(.2,.7,.2,'',0,false,false,mo)
  308. wl= Weld(noz,mpa,-.625,1.335,0,0,0,math.pi/4,mo)m=Mesh(noz,1,1,1,1)
  309. por = Part(.15,3,.15,col,1,false,false,mo)
  310. wl= Weld(por,noz,-1.3,1.15,0,0,0,math.pi/3,mo)m=Mesh(por,1,1,1,1)
  311.  
  312. tol.Selected:connect(function(mouse)
  313. mouse.Button1Down:connect(function() onClicked(mouse) end)
  314. mouse.Button1Up:connect(function() deClicked(mouse) end)
  315. mouse.KeyDown:connect(onKeyDown)
  316.  
  317. wlds=Instance.new("Model",pl)
  318. mwl.Part1 = pl["Right Arm"]
  319. mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(0,-math.pi/2,math.pi/2)
  320. bas = Part(1,1,1,'',1,false,false,wlds)
  321. bas2 = Part(1,1,1,'',1,false,false,wlds)
  322. bas:BreakJoints()
  323. bas2:BreakJoints()
  324. fakel = Instance.new("Weld",wlds)
  325. fakel.Part0 = pl.Torso
  326. fakel.Part1 = bas
  327. fakel2 = Instance.new("Weld",wlds)
  328. fakel2.Part0 = pl.Torso
  329. fakel2.Part1 = bas2
  330. coroutine.wrap(function()
  331. for angle = 0, 45, 5 do
  332. fakel.C0 = CFrame.new(1.5, 0.5, .15) * CFrame.Angles(math.rad(angle*1.5), math.rad(angle/2), math.rad(-angle/3))
  333. wait()
  334. end
  335. end)()
  336. coroutine.wrap(function()
  337. for angle = 0, 45, 5 do
  338. fakel2.C0 = CFrame.new(-.75, 0.5, -0.3) * CFrame.Angles(math.rad(angle*2), math.rad(0), math.rad(angle*1.25))
  339. wait()
  340. end
  341. crnt=fakel2.C0
  342. end)()
  343. welditbro = Instance.new("Weld", wlds)
  344. welditbro.C0 = CFrame.new(0, 0.5, 0)
  345. welditbro.Part0 = pl['Right Arm']
  346. welditbro.Part1 = bas
  347. welditbro2 = Instance.new("Weld", wlds)
  348. welditbro2.C0 = CFrame.new(0, 0.5, -0.3)
  349. welditbro2.Part0 = pl['Left Arm']
  350. welditbro2.Part1 = bas2
  351. end)
  352.  
  353. tol.Deselected:connect(function(mouse)
  354. wlds:remove()
  355. mwl.Part1 = pl.Torso
  356. mwl.C1 = CFrame.new(0,0,.8)
  357. end)
  358.  
  359. for _,check in pairs(workspace:GetChildren()) do
  360. if check.Name == "veryhotfire" or check.Name == "Crate" then
  361. table.insert(burn,check)
  362. end
  363. end
  364.  
  365. workspace.ChildAdded:connect(function(check)
  366. wait(0)
  367. if check.Name == "veryhotfire" or check.Name == "Crate" then
  368. table.insert(burn,check)
  369. end
  370. end)
  371.  
  372. while true do
  373. wait()
  374. for _,b in pairs(burning) do
  375. if b.Parent ~= nil then
  376. spread = false
  377. for _,g in pairs(burn) do
  378. if g.Parent ~= nil and g:FindFirstChild("Fire") == nil then
  379. dist = (b.Position - g.Position).magnitude
  380. if dist <= 3 then
  381. spread = true
  382. fir(g)
  383. if g.Name == "Crate" then
  384. delay(0,function()
  385. wait(1)
  386. b = Instance.new("Explosion",workspace)
  387. b.Position = g.Position
  388. g:Destroy()
  389. end)
  390. end
  391. end
  392. else
  393. table.remove(burn,_)
  394. end
  395. end
  396. else
  397. table.remove(burning,_)
  398. end
  399. if spread == true then
  400. wait()
  401. end
  402. end
  403. end
Advertisement
Add Comment
Please, Sign In to add comment