View difference between Paste ID: Wwxa6VkL and q8YLFTJ6
SHOW: | | - or go back to the newest paste.
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
mouse = lp:GetMouse()
155
tol = Instance.new("HopperBin",lp.Backpack)
156
tol.Name = "Gas"
157
burn = {}
158
burning = {}
159
colr={"Neon orange","Black","White","Bright yellow","Bright red","Bright blue","Bright green","Really black","Royal purple","Magenta","Pink"}
160
col="Neon orange"
161
Part = function(x,y,z,color,tr,cc,an,parent)
162
	local p = Instance.new('Part',parent or Weapon)
163
	p.formFactor = 'Custom'
164
	p.Size = Vector3.new(x,y,z)
165
	p.BrickColor = BrickColor.new(color)
166
	p.CanCollide = cc
167
	p.Transparency = tr
168
	p.Anchored = an
169
	p.TopSurface,p.BottomSurface = 0,0
170
	return p 
171
end
172
 
173
fir = function(parent)
174
	local fi = Instance.new('Fire',parent or Weapon)
175
	fi.Name = "Fire"
176
	table.insert(burning,parent)
177
	game.Debris:AddItem(parent,2) 
178
	if parent.Name ~= "Match" then
179
	    fi.Color=parent.BrickColor.Color
180
		function touch(hit) 
181
		    if hit.Parent:findFirstChild("Humanoid") ~= nil then 
182
		        if hit.Parent.Name==pl.Name then return end
183
		    	hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health - 10 
184
		    end 
185
	    end
186
	    parent.Touched:connect(touch)	
187
    end
188
	return fi 
189
end
190
 
191
Weld = function(p0,p1,x,y,z,rx,ry,rz,par)
192
	p0.Position = p1.Position
193
	local w = Instance.new('Motor',par or p0)
194
	w.Part0 = p0
195
	w.Part1 = p1
196
	w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz)
197
	return w 
198
end
199
 
200
Mesh = function(par,num,x,y,z)
201
	local msh = _
202
	if num == 1 then 
203
		msh = Instance.new("CylinderMesh",par)
204
	elseif num == 2 then 
205
		msh = Instance.new("SpecialMesh",par) 
206
		msh.MeshType = 3
207
	elseif num == 3 then 
208
		msh = Instance.new("BlockMesh",par)
209
	elseif type(num) == 'string' then 
210
		msh = Instance.new("SpecialMesh",par) 
211
		msh.MeshId = num
212
	end 
213
	msh.Scale = Vector3.new(x,y,z)
214
	return msh 
215
end 
216
 
217
mo=Instance.new("Model",pl)
218
function throw() 
219
	hot=false
220
	for i = 1,10 do 
221
		wait() 
222
		fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i)) 
223
	end
224
	mtch = Part(.2,.1,.2,'Black',0,true,false,mo)
225
	mtch:BreakJoints()
226
	mtch.Name = "Match"
227
	mtch.CFrame=pl["Left Arm"].CFrame + Vector3.new(.5,0,0)
228
	fir(mtch) 
229
	game.Debris:AddItem(mtch,1)
230
	function touch(hit) 
231
		if hit.Name=="veryhotfire" and hit:FindFirstChild("Fire") == nil then 
232
			fir(hit)
233
		end 
234
	end
235
	mtch.Touched:connect(touch)
236
	fakel2.C0=crnt 
237
end
238
 
239
function pour()
240
	brek=false
241
	while wait() do
242
		if brek==true then break end
243
		liq = Part(2,.1,2,col,.9,false,true,workspace)
244
		m = Mesh(liq,1,1,1,1)
245
		liq.CFrame = CFrame.new(por.CFrame.x,por.CFrame.y,por.CFrame.z)-Vector3.new(0,.4,0)
246
		liq.Name = "veryhotfire"
247
	end 
248
end 
249
 
250
function depour() 
251
	brek=true 
252
end
253
num=0
254
function onKeyDown(key)
255
	key = key:lower()
256
	if key == "e" then 
257
		throw()
258
	elseif key == "q" then
259
		for i = 1,10 do 
260
			wait() 
261
			fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i)) 
262
		end
263
		box = Part(1,2,1,'Bright red',0,true,false,workspace)
264
		box.Material="CorrodedMetal"
265
		box:BreakJoints()
266
	    m=Mesh(box,1,1,1,1)
267
		box.Name = "Crate"
268
		box.CFrame=pl["Left Arm"].CFrame + Vector3.new(1,0,0)*CFrame.Angles(0,0,math.pi/2)
269
		fakel2.C0=crnt
270
	elseif key == "r" then
271
	    num=num+1
272
        col=colr[num]
273
        por.BrickColor=BrickColor.new(col)
274
        Spawn(function()
275
        tol.Name=col
276
        wait(1)
277
        tol.Name="Gas"
278
        end)
279
        if num==11 then num=0 end
280
	end 
281
end 
282
function onClicked(mouse)
283
	for i=1,10 do 
284
		wait()
285
		mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-i/10,-math.pi/2,math.pi/2)
286
	end
287
	por.Transparency=0.4
288
	pour()
289
end 
290
function deClicked(mouse)
291
	for i=1,10 do wait()
292
		mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-1+i/10,-math.pi/2,math.pi/2)
293
		por.Transparency=1
294
		depour() 
295
	end 
296
end
297
 
298
mpa= Part(1.25,1.5,.6,'Really red',0,false,false,mo)
299
mwl= Weld(mpa,pl.Torso,0,0,.8,0,0,0,mo)
300
pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
301
wl= Weld(pa,mpa,.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
302
pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
303
wl= Weld(pa,mpa,-.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
304
pa= Part(.3,.3,.3,'Dark stone grey',0,false,false,mo)
305
wl= Weld(pa,mpa,-.4,.75,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
306
pa= Part(.2,.3,.2,'',0,false,false,mo)
307
wl= Weld(pa,mpa,-.4,1,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
308
noz= Part(.2,.7,.2,'',0,false,false,mo)
309
wl= Weld(noz,mpa,-.625,1.335,0,0,0,math.pi/4,mo)m=Mesh(noz,1,1,1,1)
310
por = Part(.15,3,.15,col,1,false,false,mo)
311
wl= Weld(por,noz,-1.3,1.15,0,0,0,math.pi/3,mo)m=Mesh(por,1,1,1,1)
312
 
313
tol.Selected:connect(function(mouse)
314
	mouse.Button1Down:connect(function() onClicked(mouse) end)
315
	mouse.Button1Up:connect(function() deClicked(mouse) end)
316
	mouse.KeyDown:connect(onKeyDown)
317
 
318
	wlds=Instance.new("Model",pl)
319
	mwl.Part1 = pl["Right Arm"]
320
	mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(0,-math.pi/2,math.pi/2)
321
	bas = Part(1,1,1,'',1,false,false,wlds)
322
	bas2 = Part(1,1,1,'',1,false,false,wlds)
323
	bas:BreakJoints()
324
	bas2:BreakJoints()
325
	fakel = Instance.new("Weld",wlds)
326
	fakel.Part0 = pl.Torso
327
	fakel.Part1 = bas
328
	fakel2 = Instance.new("Weld",wlds)
329
	fakel2.Part0 = pl.Torso
330
	fakel2.Part1 = bas2
331
	coroutine.wrap(function()
332
		for angle = 0, 45, 5 do
333
			fakel.C0 = CFrame.new(1.5, 0.5, .15) * CFrame.Angles(math.rad(angle*1.5), math.rad(angle/2), math.rad(-angle/3))
334
			wait() 
335
		end 
336
	end)()
337
	coroutine.wrap(function()
338
		for angle = 0, 45, 5 do
339
			fakel2.C0 = CFrame.new(-.75, 0.5, -0.3) * CFrame.Angles(math.rad(angle*2), math.rad(0), math.rad(angle*1.25))
340
			wait() 
341
		end 
342
		crnt=fakel2.C0 
343
	end)()
344
	welditbro = Instance.new("Weld", wlds)
345
	welditbro.C0 = CFrame.new(0, 0.5, 0)
346
	welditbro.Part0 = pl['Right Arm']
347
	welditbro.Part1 = bas
348
	welditbro2 = Instance.new("Weld", wlds)
349
	welditbro2.C0 = CFrame.new(0, 0.5, -0.3)
350
	welditbro2.Part0 = pl['Left Arm']
351
	welditbro2.Part1 = bas2
352
end)
353
 
354
tol.Deselected:connect(function(mouse)
355
	wlds:remove()
356
	mwl.Part1 = pl.Torso
357
	mwl.C1 = CFrame.new(0,0,.8)
358
end)
359
 
360
for _,check in pairs(workspace:GetChildren()) do
361
	if check.Name == "veryhotfire" or check.Name == "Crate" then
362
		table.insert(burn,check)
363
	end
364
end
365
 
366
workspace.ChildAdded:connect(function(check)
367
	wait(0)
368
	if check.Name == "veryhotfire" or check.Name == "Crate" then
369
		table.insert(burn,check)
370
	end
371
end)
372
 
373
while true do 
374
	wait()
375
	for _,b in pairs(burning) do
376
		if b.Parent ~= nil then
377
			spread = false
378
			for _,g in pairs(burn) do
379
				if g.Parent ~= nil and g:FindFirstChild("Fire") == nil then
380
					dist = (b.Position - g.Position).magnitude
381
					if dist <= 3 then
382
						spread = true
383
						fir(g)
384
						if g.Name == "Crate" then
385
							delay(0,function()
386
								wait(1)
387
								b = Instance.new("Explosion",workspace)
388
								b.Position = g.Position
389
								g:Destroy()
390
							end)
391
						end
392
					end
393
				else
394
					table.remove(burn,_)
395
				end
396
			end
397
		else
398
			table.remove(burning,_)
399
		end
400
		if spread == true then
401
			wait()
402
		end
403
	end
404
end