Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --just put this on the top of a script and boom 89% works
- --note this does not work on big scripts
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- local rp = RealPlayer
- script.Parent = rp.Character
- --RemoteEvent for communicating
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- --Fake event to make stuff like Mouse.KeyDown work
- local function fakeEvent()
- local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
- t.connect = t.Connect
- return t
- end
- --Creating fake input objects with fake variables
- local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function te(self,ev,...)
- local t = m[ev]
- if t and t._fakeEvent then
- for _,f in pairs(t.Functions) do
- f(...)
- end
- end
- end
- m.TrigEvent = te
- UIS.TrigEvent = te
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=rp then return end
- m.Target = io.Target
- m.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return m:TrigEvent(b and "Button1Down" or "Button1Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[
- local Player = game:GetService("Players").LocalPlayer
- local Event = script:WaitForChild("UserInput_Event")
- local Mouse = Player:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,a)
- if a then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data 30 times every second, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- while wait(1/30) do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- end]==],Player.Character)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local _rg = game
- --Metatable for fake service
- local fsmt = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then return s[k] end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end,
- __call = function(self,...)
- local s = rawget(self,"_RealService")
- if s then return s(...) end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
- return setmetatable(t,fsmt)
- end
- --Fake game object
- local g = {
- GetService = function(self,s)
- return self[s]
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- }
- rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
- g.service = g.GetService
- g.RunService = FakeService({
- RenderStepped = _rg:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- setmetatable(g,{
- __index=function(self,s)
- return _rg:GetService(s) or typeof(_rg[s])=="function"
- and function(_,...)return _rg[s](_rg,...)end or _rg[s]
- end,
- __newindex = fsmt.__newindex,
- __call = fsmt.__call
- })
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = g,g.Players.LocalPlayer
- end
- -- Gas
- -- By : jarredbcv
- -- Fire spread by : samfun123
- lp = game.Players.LocalPlayer
- pl = lp.Character
- mouse = lp:GetMouse()
- tol = Instance.new("HopperBin",lp.Backpack)
- tol.Name = "Gas"
- burn = {}
- burning = {}
- colr={"Neon orange","Black","White","Bright yellow","Bright red","Bright blue","Bright green","Really black","Royal purple","Magenta","Pink"}
- col="Neon orange"
- Part = function(x,y,z,color,tr,cc,an,parent)
- local p = Instance.new('Part',parent or Weapon)
- p.formFactor = 'Custom'
- p.Size = Vector3.new(x,y,z)
- p.BrickColor = BrickColor.new(color)
- p.CanCollide = cc
- p.Transparency = tr
- p.Anchored = an
- p.TopSurface,p.BottomSurface = 0,0
- return p
- end
- fir = function(parent)
- local fi = Instance.new('Fire',parent or Weapon)
- fi.Name = "Fire"
- table.insert(burning,parent)
- game.Debris:AddItem(parent,2)
- if parent.Name ~= "Match" then
- fi.Color=parent.BrickColor.Color
- function touch(hit)
- if hit.Parent:findFirstChild("Humanoid") ~= nil then
- if hit.Parent.Name==pl.Name then return end
- hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health - 10
- end
- end
- parent.Touched:connect(touch)
- end
- return fi
- end
- Weld = function(p0,p1,x,y,z,rx,ry,rz,par)
- p0.Position = p1.Position
- local w = Instance.new('Motor',par or p0)
- w.Part0 = p0
- w.Part1 = p1
- w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz)
- return w
- end
- Mesh = function(par,num,x,y,z)
- local msh = _
- if num == 1 then
- msh = Instance.new("CylinderMesh",par)
- elseif num == 2 then
- msh = Instance.new("SpecialMesh",par)
- msh.MeshType = 3
- elseif num == 3 then
- msh = Instance.new("BlockMesh",par)
- elseif type(num) == 'string' then
- msh = Instance.new("SpecialMesh",par)
- msh.MeshId = num
- end
- msh.Scale = Vector3.new(x,y,z)
- return msh
- end
- mo=Instance.new("Model",pl)
- function throw()
- hot=false
- for i = 1,10 do
- wait()
- fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i))
- end
- mtch = Part(.2,.1,.2,'Black',0,true,false,mo)
- mtch:BreakJoints()
- mtch.Name = "Match"
- mtch.CFrame=pl["Left Arm"].CFrame + Vector3.new(.5,0,0)
- fir(mtch)
- game.Debris:AddItem(mtch,1)
- function touch(hit)
- if hit.Name=="veryhotfire" and hit:FindFirstChild("Fire") == nil then
- fir(hit)
- end
- end
- mtch.Touched:connect(touch)
- fakel2.C0=crnt
- end
- function pour()
- brek=false
- while wait() do
- if brek==true then break end
- liq = Part(2,.1,2,col,.9,false,true,workspace)
- m = Mesh(liq,1,1,1,1)
- liq.CFrame = CFrame.new(por.CFrame.x,por.CFrame.y,por.CFrame.z)-Vector3.new(0,.4,0)
- liq.Name = "veryhotfire"
- end
- end
- function depour()
- brek=true
- end
- num=0
- function onKeyDown(key)
- key = key:lower()
- if key == "e" then
- throw()
- elseif key == "q" then
- for i = 1,10 do
- wait()
- fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i))
- end
- box = Part(1,2,1,'Bright red',0,true,false,workspace)
- box.Material="CorrodedMetal"
- box:BreakJoints()
- m=Mesh(box,1,1,1,1)
- box.Name = "Crate"
- box.CFrame=pl["Left Arm"].CFrame + Vector3.new(1,0,0)*CFrame.Angles(0,0,math.pi/2)
- fakel2.C0=crnt
- elseif key == "r" then
- num=num+1
- col=colr[num]
- por.BrickColor=BrickColor.new(col)
- Spawn(function()
- tol.Name=col
- wait(1)
- tol.Name="Gas"
- end)
- if num==11 then num=0 end
- end
- end
- function onClicked(mouse)
- for i=1,10 do
- wait()
- mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-i/10,-math.pi/2,math.pi/2)
- end
- por.Transparency=0.4
- pour()
- end
- function deClicked(mouse)
- for i=1,10 do wait()
- mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-1+i/10,-math.pi/2,math.pi/2)
- por.Transparency=1
- depour()
- end
- end
- mpa= Part(1.25,1.5,.6,'Really red',0,false,false,mo)
- mwl= Weld(mpa,pl.Torso,0,0,.8,0,0,0,mo)
- pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
- wl= Weld(pa,mpa,.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
- pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
- wl= Weld(pa,mpa,-.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
- pa= Part(.3,.3,.3,'Dark stone grey',0,false,false,mo)
- wl= Weld(pa,mpa,-.4,.75,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
- pa= Part(.2,.3,.2,'',0,false,false,mo)
- wl= Weld(pa,mpa,-.4,1,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
- noz= Part(.2,.7,.2,'',0,false,false,mo)
- wl= Weld(noz,mpa,-.625,1.335,0,0,0,math.pi/4,mo)m=Mesh(noz,1,1,1,1)
- por = Part(.15,3,.15,col,1,false,false,mo)
- wl= Weld(por,noz,-1.3,1.15,0,0,0,math.pi/3,mo)m=Mesh(por,1,1,1,1)
- tol.Selected:connect(function(mouse)
- mouse.Button1Down:connect(function() onClicked(mouse) end)
- mouse.Button1Up:connect(function() deClicked(mouse) end)
- mouse.KeyDown:connect(onKeyDown)
- wlds=Instance.new("Model",pl)
- mwl.Part1 = pl["Right Arm"]
- mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(0,-math.pi/2,math.pi/2)
- bas = Part(1,1,1,'',1,false,false,wlds)
- bas2 = Part(1,1,1,'',1,false,false,wlds)
- bas:BreakJoints()
- bas2:BreakJoints()
- fakel = Instance.new("Weld",wlds)
- fakel.Part0 = pl.Torso
- fakel.Part1 = bas
- fakel2 = Instance.new("Weld",wlds)
- fakel2.Part0 = pl.Torso
- fakel2.Part1 = bas2
- coroutine.wrap(function()
- for angle = 0, 45, 5 do
- fakel.C0 = CFrame.new(1.5, 0.5, .15) * CFrame.Angles(math.rad(angle*1.5), math.rad(angle/2), math.rad(-angle/3))
- wait()
- end
- end)()
- coroutine.wrap(function()
- for angle = 0, 45, 5 do
- fakel2.C0 = CFrame.new(-.75, 0.5, -0.3) * CFrame.Angles(math.rad(angle*2), math.rad(0), math.rad(angle*1.25))
- wait()
- end
- crnt=fakel2.C0
- end)()
- welditbro = Instance.new("Weld", wlds)
- welditbro.C0 = CFrame.new(0, 0.5, 0)
- welditbro.Part0 = pl['Right Arm']
- welditbro.Part1 = bas
- welditbro2 = Instance.new("Weld", wlds)
- welditbro2.C0 = CFrame.new(0, 0.5, -0.3)
- welditbro2.Part0 = pl['Left Arm']
- welditbro2.Part1 = bas2
- end)
- tol.Deselected:connect(function(mouse)
- wlds:remove()
- mwl.Part1 = pl.Torso
- mwl.C1 = CFrame.new(0,0,.8)
- end)
- for _,check in pairs(workspace:GetChildren()) do
- if check.Name == "veryhotfire" or check.Name == "Crate" then
- table.insert(burn,check)
- end
- end
- workspace.ChildAdded:connect(function(check)
- wait(0)
- if check.Name == "veryhotfire" or check.Name == "Crate" then
- table.insert(burn,check)
- end
- end)
- while true do
- wait()
- for _,b in pairs(burning) do
- if b.Parent ~= nil then
- spread = false
- for _,g in pairs(burn) do
- if g.Parent ~= nil and g:FindFirstChild("Fire") == nil then
- dist = (b.Position - g.Position).magnitude
- if dist <= 3 then
- spread = true
- fir(g)
- if g.Name == "Crate" then
- delay(0,function()
- wait(1)
- b = Instance.new("Explosion",workspace)
- b.Position = g.Position
- g:Destroy()
- end)
- end
- end
- else
- table.remove(burn,_)
- end
- end
- else
- table.remove(burning,_)
- end
- if spread == true then
- wait()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement