View difference between Paste ID: 4et5nfjX and HW208cFY
SHOW: | | - or go back to the newest paste.
1
-- Gas
2
-- By : jarredbcv
3
-- Fire spread by : samfun123
4
 
5
lp = game.Players.LocalPlayer
6
pl = lp.Character
7
tol = Instance.new("HopperBin",lp.Backpack)
8
tol.Name = "Gas"
9
burn = {}
10
burning = {}
11-
colr={"Neon orange","Black","White","Bright yellow","Bright red","Bright blue","Bright green","Really black","Royal purple","Magenta","Pink"}
11+
colr={"Hot pink"}
12-
col="Neon orange"
12+
col="Hot pink"
13
Part = function(x,y,z,color,tr,cc,an,parent)
14
	local p = Instance.new('Part',parent or Weapon)
15
	p.formFactor = 'Custom'
16
	p.Size = Vector3.new(x,y,z)
17
	p.BrickColor = BrickColor.new(color)
18
	p.CanCollide = cc
19
	p.Transparency = tr
20
	p.Anchored = an
21
	p.TopSurface,p.BottomSurface = 0,0
22
	return p 
23
end
24
 
25
fir = function(parent)
26
	local fi = Instance.new('Fire',parent or Weapon)
27
	fi.Name = "Fire"
28
	table.insert(burning,parent)
29
	game.Debris:AddItem(parent,2) 
30
	if parent.Name ~= "Match" then
31
	    fi.Color=parent.BrickColor.Color
32
		function touch(hit) 
33
		    if hit.Parent:findFirstChild("Humanoid") ~= nil then 
34
		        if hit.Parent.Name==pl.Name then return end
35
		    	hit.Parent.Humanoid.Health=hit.Parent.Humanoid.Health - 10 
36
		    end 
37
	    end
38
	    parent.Touched:connect(touch)	
39
    end
40
	return fi 
41
end
42
 
43
Weld = function(p0,p1,x,y,z,rx,ry,rz,par)
44
	p0.Position = p1.Position
45
	local w = Instance.new('Motor',par or p0)
46
	w.Part0 = p0
47
	w.Part1 = p1
48
	w.C1 = CFrame.new(x,y,z)*CFrame.Angles(rx,ry,rz)
49
	return w 
50
end
51
 
52
Mesh = function(par,num,x,y,z)
53
	local msh = _
54
	if num == 1 then 
55
		msh = Instance.new("CylinderMesh",par)
56
	elseif num == 2 then 
57
		msh = Instance.new("SpecialMesh",par) 
58
		msh.MeshType = 3
59
	elseif num == 3 then 
60
		msh = Instance.new("BlockMesh",par)
61
	elseif type(num) == 'string' then 
62
		msh = Instance.new("SpecialMesh",par) 
63
		msh.MeshId = num
64
	end 
65
	msh.Scale = Vector3.new(x,y,z)
66
	return msh 
67
end 
68
 
69
mo=Instance.new("Model",pl)
70
function throw() 
71
	hot=false
72
	for i = 1,10 do 
73
		wait() 
74
		fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i)) 
75
	end
76
	mtch = Part(.2,.1,.2,'Black',0,true,false,mo)
77
	mtch:BreakJoints()
78
	mtch.Name = "Match"
79
	mtch.CFrame=pl["Left Arm"].CFrame + Vector3.new(.5,0,0)
80
	fir(mtch) 
81
	game.Debris:AddItem(mtch,1)
82
	function touch(hit) 
83
		if hit.Name=="veryhotfire" and hit:FindFirstChild("Fire") == nil then 
84
			fir(hit)
85
		end 
86
	end
87
	mtch.Touched:connect(touch)
88
	fakel2.C0=crnt 
89
end
90
 
91
function pour()
92
	brek=false
93
	while wait() do
94
		if brek==true then break end
95
		liq = Part(2,.1,2,col,.9,false,true,workspace)
96
		m = Mesh(liq,1,1,1,1)
97
		liq.CFrame = CFrame.new(por.CFrame.x,por.CFrame.y,por.CFrame.z)-Vector3.new(0,.4,0)
98
		liq.Name = "veryhotfire"
99
	end 
100
end 
101
 
102
function depour() 
103
	brek=true 
104
end
105
num=0
106
function onKeyDown(key)
107
	key = key:lower()
108
	if key == "e" then 
109
		throw()
110
	elseif key == "q" then
111
		for i = 1,10 do 
112
			wait() 
113
			fakel2.C0=fakel2.C0* CFrame.Angles(0, 0, math.rad(-i)) 
114
		end
115-
		box = Part(1,2,1,'Bright red',0,true,false,workspace)
115+
		box = Part(1,2,1,'Hot pink',0,true,false,workspace)
116
		box.Material="CorrodedMetal"
117
		box:BreakJoints()
118
	    m=Mesh(box,1,1,1,1)
119
		box.Name = "Crate"
120
		box.CFrame=pl["Left Arm"].CFrame + Vector3.new(1,0,0)*CFrame.Angles(0,0,math.pi/2)
121
		fakel2.C0=crnt
122
	elseif key == "r" then
123
	    num=num+1
124
        col=colr[num]
125
        por.BrickColor=BrickColor.new(col)
126
        Spawn(function()
127
        tol.Name=col
128
        wait(1)
129
        tol.Name="Gas"
130
        end)
131
        if num==11 then num=0 end
132
	end 
133
end 
134
function onClicked(mouse)
135
	for i=1,10 do 
136
		wait()
137
		mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-i/10,-math.pi/2,math.pi/2)
138
	end
139
	por.Transparency=0.4
140
	pour()
141
end 
142
function deClicked(mouse)
143
	for i=1,10 do wait()
144
		mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(-1+i/10,-math.pi/2,math.pi/2)
145
		por.Transparency=1
146
		depour() 
147
	end 
148
end
149
 
150-
mpa= Part(1.25,1.5,.6,'Really red',0,false,false,mo)
150+
mpa= Part(1.25,1.5,.6,'Hot pink',0,false,false,mo)
151
mwl= Weld(mpa,pl.Torso,0,0,.8,0,0,0,mo)
152-
pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
152+
pa= Part(.6,1.5,.6,'Hot pink',0,false,false,mo)
153
wl= Weld(pa,mpa,.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
154-
pa= Part(.6,1.5,.6,'Really red',0,false,false,mo)
154+
pa= Part(.6,1.5,.6,'Hot pink',0,false,false,mo)
155
wl= Weld(pa,mpa,-.61,0,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
156-
pa= Part(.3,.3,.3,'Dark stone grey',0,false,false,mo)
156+
pa= Part(.3,.3,.3,'Hot pink',0,false,false,mo)
157
wl= Weld(pa,mpa,-.4,.75,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
158
pa= Part(.2,.3,.2,'',0,false,false,mo)
159
wl= Weld(pa,mpa,-.4,1,0,0,0,0,mo)m=Mesh(pa,1,1,1,1)
160
noz= Part(.2,.7,.2,'',0,false,false,mo)
161
wl= Weld(noz,mpa,-.625,1.335,0,0,0,math.pi/4,mo)m=Mesh(noz,1,1,1,1)
162
por = Part(.15,3,.15,col,1,false,false,mo)
163
wl= Weld(por,noz,-1.3,1.15,0,0,0,math.pi/3,mo)m=Mesh(por,1,1,1,1)
164
 
165
tol.Selected:connect(function(mouse)
166
	mouse.Button1Down:connect(function() onClicked(mouse) end)
167
	mouse.Button1Up:connect(function() deClicked(mouse) end)
168
	mouse.KeyDown:connect(onKeyDown)
169
 
170
	wlds=Instance.new("Model",pl)
171
	mwl.Part1 = pl["Right Arm"]
172
	mwl.C1 = CFrame.new(0,-1.5,0)*CFrame.Angles(0,-math.pi/2,math.pi/2)
173
	bas = Part(1,1,1,'',1,false,false,wlds)
174
	bas2 = Part(1,1,1,'',1,false,false,wlds)
175
	bas:BreakJoints()
176
	bas2:BreakJoints()
177
	fakel = Instance.new("Weld",wlds)
178
	fakel.Part0 = pl.Torso
179
	fakel.Part1 = bas
180
	fakel2 = Instance.new("Weld",wlds)
181
	fakel2.Part0 = pl.Torso
182
	fakel2.Part1 = bas2
183
	coroutine.wrap(function()
184
		for angle = 0, 45, 5 do
185
			fakel.C0 = CFrame.new(1.5, 0.5, .15) * CFrame.Angles(math.rad(angle*1.5), math.rad(angle/2), math.rad(-angle/3))
186
			wait() 
187
		end 
188
	end)()
189
	coroutine.wrap(function()
190
		for angle = 0, 45, 5 do
191
			fakel2.C0 = CFrame.new(-.75, 0.5, -0.3) * CFrame.Angles(math.rad(angle*2), math.rad(0), math.rad(angle*1.25))
192
			wait() 
193
		end 
194
		crnt=fakel2.C0 
195
	end)()
196
	welditbro = Instance.new("Weld", wlds)
197
	welditbro.C0 = CFrame.new(0, 0.5, 0)
198
	welditbro.Part0 = pl['Right Arm']
199
	welditbro.Part1 = bas
200
	welditbro2 = Instance.new("Weld", wlds)
201
	welditbro2.C0 = CFrame.new(0, 0.5, -0.3)
202
	welditbro2.Part0 = pl['Left Arm']
203
	welditbro2.Part1 = bas2
204
end)
205
 
206
tol.Deselected:connect(function(mouse)
207
	wlds:remove()
208
	mwl.Part1 = pl.Torso
209
	mwl.C1 = CFrame.new(0,0,.8)
210
end)
211
 
212
for _,check in pairs(workspace:GetChildren()) do
213
	if check.Name == "veryhotfire" or check.Name == "Crate" then
214
		table.insert(burn,check)
215
	end
216
end
217
 
218
workspace.ChildAdded:connect(function(check)
219
	wait(0)
220
	if check.Name == "veryhotfire" or check.Name == "Crate" then
221
		table.insert(burn,check)
222
	end
223
end)
224
 
225
while true do 
226
	wait()
227
	for _,b in pairs(burning) do
228
		if b.Parent ~= nil then
229
			spread = false
230
			for _,g in pairs(burn) do
231
				if g.Parent ~= nil and g:FindFirstChild("Fire") == nil then
232
					dist = (b.Position - g.Position).magnitude
233
					if dist <= 3 then
234
						spread = true
235
						fir(g)
236
						if g.Name == "Crate" then
237
							delay(0,function()
238
								wait(1)
239
								b = Instance.new("Explosion",workspace)
240
								b.Position = g.Position
241
								g:Destroy()
242
							end)
243
						end
244
					end
245
				else
246
					table.remove(burn,_)
247
				end
248
			end
249
		else
250
			table.remove(burning,_)
251
		end
252
		if spread == true then
253
			wait()
254
		end
255
	end
256
end