View difference between Paste ID: gvrnHsUV and sqMRJDsM
SHOW: | | - or go back to the newest paste.
1
local runDummyScript = function(f,scri)
2
local oldenv = getfenv(f)
3
local newenv = setmetatable({}, {
4
__index = function(_, k)
5
if k:lower() == 'script' then
6
return scri
7
else
8
return oldenv[k]
9
end
10
end
11
})
12
setfenv(f, newenv)
13
ypcall(function() f() end)
14
end
15
cors = {}
16
mas = Instance.new("Model",game:GetService("Lighting")) 
17
mas.Name = "CompiledModel"
18
o1 = Instance.new("Model")
19
o2 = Instance.new("Model")
20
o3 = Instance.new("Part")
21
o5 = Instance.new("Humanoid")
22
o7 = Instance.new("Part")
23
o8 = Instance.new("SpecialMesh")
24
o14 = Instance.new("SpecialMesh")
25
o15 = Instance.new("Motor6D")
26
o16 = Instance.new("Sound")
27
o17 = Instance.new("Sound")
28
o18 = Instance.new("Sound")
29
o19 = Instance.new("Sound")
30
o20 = Instance.new("Sound")
31
o21 = Instance.new("Sound")
32
o22 = Instance.new("Sound")
33
o23 = Instance.new("Sound")
34
o24 = Instance.new("Sound")
35
o25 = Instance.new("Motor6D")
36
o26 = Instance.new("Motor6D")
37
o27 = Instance.new("Sound")
38
o28 = Instance.new("Script")
39
o29 = Instance.new("BodyColors")
40
o30 = Instance.new("Script")
41
o31 = Instance.new("Script")
42
o32 = Instance.new("Script")
43
o33 = Instance.new("Script")
44
o34 = Instance.new("Script")
45
o35 = Instance.new("Script")
46
o38 = Instance.new("Vector3Value")
47
o39 = Instance.new("Motor6D")
48
o48 = Instance.new("Vector3Value")
49
o49 = Instance.new("Motor6D")
50
o60 = Instance.new("Vector3Value")
51
o61 = Instance.new("Motor6D")
52
o66 = Instance.new("Vector3Value")
53
o67 = Instance.new("Motor6D")
54
o71 = Instance.new("Vector3Value")
55
o72 = Instance.new("Motor6D")
56
o77 = Instance.new("Vector3Value")
57
o78 = Instance.new("Motor6D")
58
o82 = Instance.new("Vector3Value")
59
o83 = Instance.new("Motor6D")
60
o87 = Instance.new("Vector3Value")
61
o88 = Instance.new("Motor6D")
62
o92 = Instance.new("Vector3Value")
63
o93 = Instance.new("Motor6D")
64
o97 = Instance.new("Vector3Value")
65
o98 = Instance.new("Motor6D")
66
o101 = Instance.new("Vector3Value")
67
o102 = Instance.new("Motor6D")
68
o106 = Instance.new("Vector3Value")
69
o107 = Instance.new("Motor6D")
70
o111 = Instance.new("Vector3Value")
71
o112 = Instance.new("Motor6D")
72
o113 = Instance.new("Script")
73
o117 = Instance.new("Vector3Value")
74
o118 = Instance.new("Motor6D")
75
o119 = Instance.new("Script")
76
o120 = Instance.new("Script")
77
o121 = Instance.new("Script")
78
o122 = Instance.new("Script")
79
o123 = Instance.new("Part")
80
o124 = Instance.new("Part")
81
o125 = Instance.new("Script")
82
o126 = Instance.new("StringValue")
83
o127 = Instance.new("StringValue")
84
o128 = Instance.new("Animation")
85
o129 = Instance.new("StringValue")
86
o130 = Instance.new("StringValue")
87
o131 = Instance.new("Animation")
88
o132 = Instance.new("StringValue")
89
o133 = Instance.new("Animation")
90
o134 = Instance.new("StringValue")
91
o135 = Instance.new("Animation")
92
o136 = Instance.new("StringValue")
93
o137 = Instance.new("Animation")
94
o138 = Instance.new("StringValue")
95
o139 = Instance.new("StringValue")
96
o140 = Instance.new("Animation")
97
o141 = Instance.new("StringValue")
98
o142 = Instance.new("Animation")
99
o143 = Instance.new("Script")
100
o1.Name = "Shadow runner"
101
o1.Parent = mas
102
o2.Name = "Shadow"
103
o2.Parent = o1
104
o2.PrimaryPart = o3
105
o3.Name = "HumanoidRootPart"
106
o3.Parent = o2
107
o3.Transparency = 1
108
o3.Position = Vector3.new(-6.20944214, 2.32397389, -11.42136)
109
o3.Rotation = Vector3.new(-180, -77.4799957, -180)
110
o3.CanCollide = false
111
o3.Size = Vector3.new(2, 2, 1)
112
o3.CFrame = CFrame.new(-6.20944214, 2.32397389, -11.42136, -0.216782376, 0, -0.976219952, 0, 1, 0, 0.976219952, 0, -0.216782376)
113
o3.Position = Vector3.new(-6.20944214, 2.32397389, -11.42136)
114
o5.Parent = o2
115
o5.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
116
o5.Torso = o3
117
o5.Health = 1000
118
o5.MaxHealth = 1000
119
o5.WalkSpeed = 25
120
o7.Name = "Head"
121
o7.Parent = o2
122
o7.Material = Enum.Material.SmoothPlastic
123
o7.BrickColor = BrickColor.new("Really black")
124
o7.Position = Vector3.new(-6.20970821, 4.47397423, -11.4214191)
125
o7.Rotation = Vector3.new(-180, -77.4799957, -180)
126
o7.Size = Vector3.new(2, 1, 1)
127
o7.CFrame = CFrame.new(-6.20970821, 4.47397423, -11.4214191, -0.216782376, 0, -0.976219952, 0, 1, 0, 0.976219952, 0, -0.216782376)
128
o7.BottomSurface = Enum.SurfaceType.Smooth
129
o7.TopSurface = Enum.SurfaceType.Smooth
130
o7.Color = Color3.new(0.0666667, 0.0666667, 0.0666667)
131
o7.Position = Vector3.new(-6.20970821, 4.47397423, -11.4214191)
132
o8.Parent = o7
133
o8.Scale = Vector3.new(1.25, 1.25, 1.25)
134
o14.Parent = o7
135
o14.MeshId = "http://www.roblox.com/asset/?id=83001675"
136
o14.Scale = Vector3.new(1.25, 1.25, 1.25)
137
o14.MeshType = Enum.MeshType.FileMesh
138
o15.Name = "Neck"
139
o15.Parent = o7
140
o15.C0 = CFrame.new(-4.17232513e-07, 0.834590554, 0.0607423484, 1, 0, 0, 0, 1, 0, 0, 0, 1)
141
o15.C1 = CFrame.new(0, -0.500000119, -0.000272244215, 1, 0, 0, 0, 1, 0, 0, 0, 1)
142
o15.Part0 = mas
143
o15.Part1 = o7
144
o16.Name = "GettingUp"
145
o16.Parent = o7
146
o16.SoundId = "rbxasset://sounds/action_get_up.mp3"
147
o16.Volume = 0.64999997615814
148
o17.Name = "Died"
149
o17.Parent = o7
150
o17.SoundId = "rbxasset://sounds/uuhhh.mp3"
151
o17.Volume = 0.64999997615814
152
o18.Name = "FreeFalling"
153
o18.Parent = o7
154
o18.SoundId = "rbxasset://sounds/action_falling.mp3"
155
o18.Volume = 0.64999997615814
156
o18.Looped = true
157
o19.Name = "Jumping"
158
o19.Parent = o7
159
o19.SoundId = "rbxasset://sounds/action_jump.mp3"
160
o19.Volume = 0.64999997615814
161
o20.Name = "Landing"
162
o20.Parent = o7
163
o20.SoundId = "rbxasset://sounds/action_jump_land.mp3"
164
o20.Volume = 0.64999997615814
165
o21.Name = "Splash"
166
o21.Parent = o7
167
o21.SoundId = "rbxasset://sounds/impact_water.mp3"
168
o21.Volume = 0.64999997615814
169
o22.Name = "Running"
170
o22.Parent = o7
171
o22.Pitch = 1.8500000238419
172
o22.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
173
o22.Volume = 0.64999997615814
174
o22.Looped = true
175
o23.Name = "Swimming"
176
o23.Parent = o7
177
o23.Pitch = 1.6000000238419
178
o23.SoundId = "rbxasset://sounds/action_swim.mp3"
179
o23.Volume = 0.64999997615814
180
o23.Looped = true
181
o24.Name = "Climbing"
182
o24.Parent = o7
183
o24.SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3"
184
o24.Volume = 0.64999997615814
185
o24.Looped = true
186
o25.Parent = o7
187
o25.C1 = CFrame.new(-0.519638062, -0.206021309, 0.0883045197, -0.216782376, 0, -0.976219952, 0, 1, 0, 0.976219952, 0, -0.216782376)
188
o25.Part0 = o7
189
o25.Part1 = o124
190
o26.Parent = o7
191
o26.C1 = CFrame.new(-0.43963623, -0.206021309, -0.291698456, -0.216782376, 0, -0.976219952, 0, 1, 0, 0.976219952, 0, -0.216782376)
192
o26.Part0 = o7
193
o26.Part1 = o123
194
o27.Name = "Idle"
195
o27.Parent = o7
196
o27.SoundId = "rbxassetid://257345390"
197
o27.Volume = 1
198
o27.Looped = true
199
o28.Parent = o2
200
table.insert(cors,coroutine.create(function()
201
wait()
202
runDummyScript(function()
203
local larm = script.Parent:FindFirstChild("HumanoidRootPart")
204
local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
205
206
function findNearestTorso(pos)
207
	local list = game.Workspace:children()
208
	local torso = nil
209
	local dist = 400000
210
	local temp = nil
211
	local human = nil
212
	local temp2 = nil
213
	for x = 1, #list do
214
		temp2 = list[x]
215
		if (temp2.className == "Model") and (temp2 ~= script.Parent) then
216
			temp = temp2:findFirstChild("HumanoidRootPart")
217
			human = temp2:findFirstChild("Humanoid")
218
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
219
				if (temp.Position - pos).magnitude < dist then
220
					torso = temp
221
					dist = (temp.Position - pos).magnitude
222
				end
223
			end
224
		end
225
	end
226
	return torso
227
end
228
229
230
231
232
while true do
233
	wait(math.random(1,5))
234
	local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
235
	if target ~= nil then
236
		script.Parent.Humanoid:MoveTo(target.Position, target)
237
	end
238
239
end
240
241
end,o28)
242
end))
243
o29.Parent = o2
244
o29.HeadColor = BrickColor.new("Really black")
245
o29.LeftArmColor = BrickColor.new("Really black")
246
o29.LeftLegColor = BrickColor.new("Really black")
247
o29.RightArmColor = BrickColor.new("Really black")
248
o29.RightLegColor = BrickColor.new("Really black")
249
o29.TorsoColor = BrickColor.new("Really black")
250
o30.Name = "Health"
251
o30.Parent = o2
252
table.insert(cors,coroutine.create(function()
253
wait()
254
runDummyScript(function()
255
--Responsible for regening a player's humanoid's health
256
257
-- declarations
258
local Figure = script.Parent
259
local Head = Figure:WaitForChild("Head")
260
local Humanoid = Figure:WaitForChild("Humanoid")
261
local regening = false
262
263
-- regeneration
264
function regenHealth()
265
	if regening then return end
266
	regening = true
267
	
268
	while Humanoid.Health < Humanoid.MaxHealth do
269
		local s = wait(1)
270
		local health = Humanoid.Health
271
		if health > 0 and health < Humanoid.MaxHealth then
272
			local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
273
			health = health + newHealthDelta
274
			Humanoid.Health = math.min(health,Humanoid.MaxHealth)
275
		end
276
	end
277
	
278
	if Humanoid.Health > Humanoid.MaxHealth then
279
		Humanoid.Health = Humanoid.MaxHealth
280
	end
281
	
282
	regening = false
283
end
284
285
Humanoid.HealthChanged:connect(regenHealth)
286
  
287
end,o30)
288
end))
289
o31.Name = "Core"
290
o31.Parent = o2
291
table.insert(cors,coroutine.create(function()
292
wait()
293
runDummyScript(function()
294
print("Hello world!")
295
296
Character = script.Parent
297
Humanoid = Character.Humanoid
298
Torso = Character.Torso
299
300
function OnDeath()
301
	print("Death")
302
x=Character:GetChildren()	
303
		for i=1,#x do
304
			if (x[i].className=="Tool") then
305
			x[i].Parent = nil
306
			end
307
		end		
308
	mode = Instance.new("Model")
309
	mode.Name = ""
310
	mode.Parent = Workspace
311
    wait()
312
    Humanoid.Parent = nil
313
	THIS = script.Cleaner:clone()
314
	THIS.Parent = mode
315
	THIS.Disabled = false
316
		bland=Instance.new("Humanoid")
317
		bland.Health=0
318
		bland.MaxHealth=0
319
		bland.Parent=mode
320
		--bland.Name = "Ragdoll"	
321
	x=Character:GetChildren()	
322
		for i=1,#x do
323
			if (x[i].className=="Hat") then
324
			x[i].Handle.Anchored = true	
325
			end
326
		if (x[i].className =="Part") then
327
		x[i].Anchored = true
328
		end	
329
		end		
330
	if Torso then
331
		--Torso.Velocity = Vector3.new(0, 0, 0)
332
		--Torso.RotVelocity = Vector3.new(0, 0, 0)
333
		zam=Torso:Clone()
334
		zam.Parent=mode
335
		zam.Elasticity = 0
336
		zam.Friction = 1
337
		x=Character:GetChildren()	
338
		for i=1,#x do
339
		if ((x[i].Name=="Shirt") or (x[i].Name=="Pants") or (x[i].className=="CharacterMesh") or (x[i].className=="Hat") or (x[i].className=="Decal") or (x[i].className=="ShirtGraphic") or (x[i].className=="Model")) then
340
			local zor=x[i]:Clone()
341
			zor.Parent=mode
342
		end
343
		if x[i].Name=="Head" then
344
			--x[i].Velocity = Vector3.new(0, 0, 0)
345
			--x[i].RotVelocity = Vector3.new(0, 0, 0)
346
			local zem=x[i]:Clone()
347
			zem.Parent=mode
348
			zem.Name="Head"
349
			zem.Elasticity = 0
350
			zem.Friction = 1
351
			local Neck = Instance.new("Weld")
352
			Neck.Name = "Neck"
353
			Neck.Part0 = zam
354
			Neck.Part1 = zem
355
			Neck.C0 = CFrame.new(0, 1.5, 0)
356
			Neck.C1 = CFrame.new()
357
			Neck.Parent = zam
358
		end
359
		if x[i].Name=="Right Arm" then
360
			--x[i].Velocity = Vector3.new(0, 0, 0)
361
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
362
			local Limb=x[i]:Clone()
363
			Limb.Parent=mode
364
			Limb.CFrame = zam.CFrame * CFrame.new(1.5, 0, 0)
365
			Limb.Elasticity = 0
366
			Limb.Friction = 1
367
			local Joint = Instance.new("Rotate")
368
			Joint.Name = "RightShoulder"
369
			Joint.Part0 = zam
370
			Joint.Part1 = Limb
371
			Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
372
			Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
373
			Joint.Parent = zam
374
375
			local B = Instance.new("Part")
376
			B.TopSurface = 0
377
			B.BottomSurface = 0
378
			B.Elasticity = 0
379
			B.Friction = 1
380
			B.formFactor = "Symmetric"
381
			B.Size = Vector3.new(1, 1, 1)
382
			B.Transparency = 1
383
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
384
			B.Parent = mode
385
			local W = Instance.new("Weld")
386
			W.Part0 = Limb
387
			W.Part1 = B
388
			W.C0 = CFrame.new(0, -0.5, 0)
389
			W.Parent = Limb
390
391
		end
392
		if x[i].Name=="Left Arm" then
393
			--x[i].Velocity = Vector3.new(0, 0, 0)
394
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
395
			local Limb=x[i]:Clone()
396
			Limb.Parent=mode
397
			Limb.CFrame = zam.CFrame * CFrame.new(-1.5, 0, 0)
398
			Limb.Elasticity = 0
399
			Limb.Friction = 1
400
			local Joint = Instance.new("Rotate")
401
			Joint.Name = "LeftShoulder"
402
			Joint.Part0 = zam
403
			Joint.Part1 = Limb
404
			Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
405
			Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
406
			Joint.Parent = zam
407
408
			local B = Instance.new("Part")
409
			B.TopSurface = 0
410
			B.BottomSurface = 0
411
			B.Elasticity = 0
412
			B.Friction = 1
413
			B.formFactor = "Symmetric"
414
			B.Size = Vector3.new(1, 1, 1)
415
			B.Transparency = 1
416
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
417
			B.Parent = mode
418
			local W = Instance.new("Weld")
419
			W.Part0 = Limb
420
			W.Part1 = B
421
			W.C0 = CFrame.new(0, -0.5, 0)
422
			W.Parent = Limb
423
424
		end
425
		if x[i].Name=="Right Leg" then
426
			--x[i].Velocity = Vector3.new(0, 0, 0)
427
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
428
			local Limb=x[i]:Clone()
429
			Limb.Parent=mode
430
			Limb.CFrame = zam.CFrame * CFrame.new(0.5, -2, 0)
431
			Limb.Elasticity = 0
432
			Limb.Friction = 1
433
			local Joint = Instance.new("Rotate")
434
			Joint.Name = "RightHip"
435
			Joint.Part0 = zam
436
			Joint.Part1 = Limb
437
			Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
438
			Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
439
			Joint.Parent = zam
440
441
			local B = Instance.new("Part")
442
			B.TopSurface = 0
443
			B.BottomSurface = 0
444
			B.Elasticity = 0
445
			B.Friction = 1
446
			B.formFactor = "Symmetric"
447
			B.Size = Vector3.new(1, 1, 1)
448
			B.Transparency = 1
449
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
450
			B.Parent = mode
451
			local W = Instance.new("Weld")
452
			W.Part0 = Limb
453
			W.Part1 = B
454
			W.C0 = CFrame.new(0, -0.5, 0)
455
			W.Parent = Limb
456
457
		end
458
		if x[i].Name=="Left Leg" then
459
			--x[i].Velocity = Vector3.new(0, 0, 0)
460
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
461
			local Limb=x[i]:Clone()
462
			Limb.Parent=mode
463
			Limb.CFrame = zam.CFrame * CFrame.new(-0.5, -2, 0)
464
			Limb.Elasticity = 0
465
			Limb.Friction = 1
466
			local Joint = Instance.new("Rotate")
467
			Joint.Name = "LeftHip"
468
			Joint.Part0 = zam
469
			Joint.Part1 = Limb
470
			Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
471
			Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
472
			Joint.Parent = zam
473
474
			local B = Instance.new("Part")
475
			B.TopSurface = 0
476
			B.BottomSurface = 0
477
			B.Elasticity = 0
478
			B.Friction = 1
479
			B.formFactor = "Symmetric"
480
			B.Size = Vector3.new(1, 1, 1)
481
			B.Transparency = 1
482
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
483
			B.Parent = mode
484
			local W = Instance.new("Weld")
485
			W.Part0 = Limb
486
			W.Part1 = B
487
			W.C0 = CFrame.new(0, -0.5, 0)
488
			W.Parent = Limb
489
490
		end
491
		end
492
		
493
		local Bar = Instance.new("Part")
494
		Bar.TopSurface = 0
495
		Bar.BottomSurface = 0
496
		Bar.Elasticity = 0
497
		Bar.Friction = 1
498
		Bar.formFactor = "Symmetric"
499
		Bar.Size = Vector3.new(1, 1, 1)
500
		Bar.Transparency = 1
501
		Bar.CFrame = zam.CFrame * CFrame.new(0, 0.5, 0)
502
		Bar.Parent = mode
503
		local Weld = Instance.new("Weld")
504
		Weld.Part0 = zam
505
		Weld.Part1 = Bar
506
		Weld.C0 = CFrame.new(0, 0.5, 0)
507
		Weld.Parent = zam		
508
	end
509
	wait()
510
	Character:remove()
511
	mode:FindFirstChild("Head").Velocity = Vector3.new(0,0,0)
512
	mode:FindFirstChild("Left Arm").Velocity = Vector3.new(0,0,0)
513
	mode:FindFirstChild("Left Leg").Velocity = Vector3.new(0,0,0)
514
	mode:FindFirstChild("Right Arm").Velocity = Vector3.new(0,0,0)
515
	mode:FindFirstChild("Right Leg").Velocity = Vector3.new(0,0,0)
516
	mode:FindFirstChild("Torso").Velocity = Vector3.new(0,0,0)	
517
	x=mode:GetChildren()	
518
		for i=1,#x do
519
			if (x[i].className=="Hat") then
520
				if x[i]:findFirstChild("Handle") then
521
				x[i].Handle.Anchored = false
522
				end
523
			end
524
		if (x[i].className =="Part") then
525
		x[i].Anchored = false
526
		end	
527
		end	
528
	local b = Instance.new("BodyPosition")
529
	b.maxForce = Vector3.new(0, 3000, 0)
530
	b.position = mode:findFirstChild("Torso").Position - Vector3.new(0, 25, 0)
531
	b.Parent = mode:findFirstChild("Torso")
532
	wait(5)
533
		for i=1,#x do
534
			if (x[i].className=="Hat") then
535
				if x[i]:findFirstChild("Handle") then
536
				x[i].Handle.Anchored = true
537
				end
538
			end
539
		if (x[i].className =="Part") then
540
		x[i].Anchored = true
541
		end	
542
		end		
543
end
544
545
Humanoid.Died:connect(OnDeath)
546
end,o31)
547
end))
548
o32.Name = "Cleaner"
549
o32.Parent = o31
550
o32.Disabled = true
551
table.insert(cors,coroutine.create(function()
552
wait()
553
runDummyScript(function()
554
wait(30) -- removes the raggy in 10 seconds.
555
script.Parent:Destroy()
556
end,o32)
557
end))
558
o33.Name = "Sound"
559
o33.Parent = o2
560
table.insert(cors,coroutine.create(function()
561
wait()
562
runDummyScript(function()
563
--[[
564
	Author: @spotco
565
	This script creates sounds which are placed under the character head.
566
	These sounds are used by the "LocalSound" script.
567
	
568
	To modify this script, copy it to your "StarterPlayer/StarterCharacterScripts" folder keeping the same script name ("Sound").
569
	The default Sound script loaded for every character will then be replaced with your copy of the script.
570
]]--
571
572
function CreateNewSound(name, id, looped, pitch, parent)
573
	local sound = Instance.new("Sound")
574
	sound.SoundId = id
575
	sound.Name = name
576
	sound.archivable = false
577
	sound.Parent = parent
578
	sound.Pitch = pitch
579
	sound.Looped = looped
580
	
581
	sound.MinDistance = 5
582
	sound.MaxDistance = 150
583
	sound.Volume = 0.65
584
	
585
	return sound
586
end
587
588
local head = script.Parent:FindFirstChild("Head")
589
if head == nil then
590
	error("Sound script parent has no child Head.")
591
	return
592
end
593
594
595
CreateNewSound("GettingUp", 	"rbxasset://sounds/action_get_up.mp3",					false, 	1,		head)
596
CreateNewSound("Died", 		"rbxasset://sounds/uuhhh.mp3",							false, 	1,		head) 
597
CreateNewSound("FreeFalling", 	"rbxasset://sounds/action_falling.mp3",				true,	1,		head)
598
CreateNewSound("Jumping", 		"rbxasset://sounds/action_jump.mp3",					false,	1,		head)
599
CreateNewSound("Landing", 		"rbxasset://sounds/action_jump_land.mp3",				false,	1,		head)
600
CreateNewSound("Splash", 		"rbxasset://sounds/impact_water.mp3",					false, 	1,		head)
601
CreateNewSound("Running", 		"rbxasset://sounds/action_footsteps_plastic.mp3",		true, 	1.85,	head)
602
CreateNewSound("Swimming", 	"rbxasset://sounds/action_swim.mp3",					true,	1.6,	head)
603
CreateNewSound("Climbing", 	"rbxasset://sounds/action_footsteps_plastic.mp3",		true,	1,		head)
604
end,o33)
605
end))
606
o34.Name = "LocalSound"
607
o34.Parent = o33
608
table.insert(cors,coroutine.create(function()
609
wait()
610
runDummyScript(function()
611
--[[
612
	Author: @spotco
613
	This script runs locally for the player of the given humanoid.
614
	This script triggers humanoid sound play/pause actions locally.
615
	
616
	The Playing/TimePosition properties of Sound objects bypass FilteringEnabled, so this triggers the sound
617
	immediately for the player and is replicated to all other players.
618
	
619
	This script is optimized to reduce network traffic through minimizing the amount of property replication.
620
]]--
621
622
--All sounds are referenced by this ID
623
local SFX = {
624
	Died = 0;
625
	Running = 1;
626
	Swimming = 2;
627
	Climbing = 3,
628
	Jumping = 4;
629
	GettingUp = 5;
630
	FreeFalling = 6;
631
	FallingDown = 7;
632
	Landing = 8;
633
	Splash = 9;
634
}
635
636
local Humanoid = nil
637
local Head = nil
638
639
--SFX ID to Sound object
640
local Sounds = {}
641
642
do
643
	local Figure = script.Parent.Parent
644
	Head = Figure:WaitForChild("Head")
645
	while not Humanoid do
646
		for _,NewHumanoid in pairs(Figure:GetChildren()) do
647
			if NewHumanoid:IsA("Humanoid") then
648
				Humanoid = NewHumanoid
649
				break
650
			end
651
		end
652
		Figure.ChildAdded:wait()
653
	end
654
	
655
	Sounds[SFX.Died] = 			Head:WaitForChild("Died")
656
	Sounds[SFX.Running] = 		Head:WaitForChild("Running")
657
	Sounds[SFX.Swimming] = 	Head:WaitForChild("Swimming")
658
	Sounds[SFX.Climbing] = 	Head:WaitForChild("Climbing")
659
	Sounds[SFX.Jumping] = 		Head:WaitForChild("Jumping")
660
	Sounds[SFX.GettingUp] = 	Head:WaitForChild("GettingUp")
661
	Sounds[SFX.FreeFalling] = 	Head:WaitForChild("FreeFalling")
662
	Sounds[SFX.Landing] = 		Head:WaitForChild("Landing")
663
	Sounds[SFX.Splash] = 		Head:WaitForChild("Splash")
664
end
665
666
local Util
667
Util = {
668
	
669
	--Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
670
	YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
671
		--(y - y1)/(x - x1) = m
672
		local m = (pt1y - pt2y) / (pt1x - pt2x)
673
		--float b = pt1.y - m * pt1.x;
674
		local b = (pt1y - m * pt1x)
675
		return m * x + b
676
	end;
677
	
678
	--Clamps the value of "val" between the "min" and "max"
679
	Clamp = function(val,min,max)
680
		return math.min(max,math.max(min,val))	
681
	end;
682
	
683
	--Gets the horizontal (x,z) velocity magnitude of the given part
684
	HorizontalSpeed = function(Head)
685
		local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
686
		return hVel.magnitude	
687
	end;
688
	
689
	--Gets the vertical (y) velocity magnitude of the given part
690
	VerticalSpeed = function(Head)
691
		return math.abs(Head.Velocity.Y)
692
	end;
693
	
694
	--Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
695
	--If these properties are enabled, use them.
696
	Play = function(sound)		
697
		if sound.TimePosition ~= 0 then
698
			sound.TimePosition = 0
699
		end
700
		if not sound.IsPlaying then
701
			sound.Playing = true
702
		end
703
	end;
704
	Pause = function(sound)
705
		if sound.IsPlaying then
706
			sound.Playing = false
707
		end
708
	end;
709
	Resume = function(sound)
710
		if not sound.IsPlaying then
711
			sound.Playing = true
712
		end
713
	end;
714
	Stop = function(sound)
715
		if sound.IsPlaying then
716
			sound.Playing = false
717
		end
718
		if sound.TimePosition ~= 0 then
719
			sound.TimePosition = 0
720
		end
721
	end;
722
}
723
724
do
725
	-- List of all active Looped sounds
726
	local playingLoopedSounds = {}
727
	
728
	-- Last seen Enum.HumanoidStateType
729
	local activeState = nil
730
	
731
	-- Verify and set that "sound" is in "playingLoopedSounds".
732
	function setSoundInPlayingLoopedSounds(sound)
733
		for i=1, #playingLoopedSounds do
734
			if playingLoopedSounds[i] == sound then
735
				return
736
			end
737
		end	
738
		table.insert(playingLoopedSounds,sound)
739
	end
740
	
741
	-- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
742
	function stopPlayingLoopedSoundsExcept(except)
743
		for i=#playingLoopedSounds,1,-1 do
744
			if playingLoopedSounds[i] ~= except then
745
				Util.Pause(playingLoopedSounds[i])			
746
				table.remove(playingLoopedSounds,i)	
747
			end
748
		end
749
	end
750
	
751
	-- Table of Enum.HumanoidStateType to handling function
752
	local stateUpdateHandler = {
753
		[Enum.HumanoidStateType.Dead] = function()
754
			stopPlayingLoopedSoundsExcept()
755
			local sound = Sounds[SFX.Died]
756
			Util.Play(sound)
757
		end;
758
		
759
		[Enum.HumanoidStateType.RunningNoPhysics] = function()
760
			stateUpdated(Enum.HumanoidStateType.Running)
761
		end;
762
		
763
		[Enum.HumanoidStateType.Running] = function()	
764
			local sound = Sounds[SFX.Running]
765
			stopPlayingLoopedSoundsExcept(sound)
766
			
767
			if Util.HorizontalSpeed(Head) > 0.5 then
768
				Util.Resume(sound)
769
				setSoundInPlayingLoopedSounds(sound)
770
			else
771
				stopPlayingLoopedSoundsExcept()
772
			end
773
		end;
774
		
775
		[Enum.HumanoidStateType.Swimming] = function()
776
			if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then
777
				local splashSound = Sounds[SFX.Splash]
778
				splashSound.Volume = Util.Clamp(
779
					Util.YForLineGivenXAndTwoPts(
780
						Util.VerticalSpeed(Head), 
781
						100, 0.28, 
782
						350, 1),
783
					0,1)
784
				Util.Play(splashSound)
785
			end
786
			
787
			do
788
				local sound = Sounds[SFX.Swimming]
789
				stopPlayingLoopedSoundsExcept(sound)
790
				Util.Resume(sound)
791
				setSoundInPlayingLoopedSounds(sound)
792
			end
793
		end;
794
		
795
		[Enum.HumanoidStateType.Climbing] = function()
796
			local sound = Sounds[SFX.Climbing]
797
			if Util.VerticalSpeed(Head) > 0.1 then
798
				Util.Resume(sound)
799
				stopPlayingLoopedSoundsExcept(sound)
800
			else
801
				stopPlayingLoopedSoundsExcept()
802
			end		
803
			setSoundInPlayingLoopedSounds(sound)
804
		end;
805
		
806
		[Enum.HumanoidStateType.Jumping] = function()
807
			if activeState == Enum.HumanoidStateType.Jumping then
808
				return
809
			end		
810
			stopPlayingLoopedSoundsExcept()
811
			local sound = Sounds[SFX.Jumping]
812
			Util.Play(sound)
813
		end;
814
		
815
		[Enum.HumanoidStateType.GettingUp] = function()
816
			stopPlayingLoopedSoundsExcept()
817
			local sound = Sounds[SFX.GettingUp]
818
			Util.Play(sound)
819
		end;
820
		
821
		[Enum.HumanoidStateType.Freefall] = function()
822
			if activeState == Enum.HumanoidStateType.Freefall then
823
				return
824
			end
825
			local sound = Sounds[SFX.FreeFalling]
826
			sound.Volume = 0
827
			stopPlayingLoopedSoundsExcept()
828
		end;
829
		
830
		[Enum.HumanoidStateType.FallingDown] = function()
831
			stopPlayingLoopedSoundsExcept()
832
		end;
833
		
834
		[Enum.HumanoidStateType.Landed] = function()
835
			stopPlayingLoopedSoundsExcept()
836
			if Util.VerticalSpeed(Head) > 75 then
837
				local landingSound = Sounds[SFX.Landing]
838
				landingSound.Volume = Util.Clamp(
839
					Util.YForLineGivenXAndTwoPts(
840
						Util.VerticalSpeed(Head), 
841
						50, 0, 
842
						100, 1),
843
					0,1)
844
				Util.Play(landingSound)			
845
			end
846
		end
847
	}
848
	
849
	-- Handle state event fired or OnChange fired
850
	function stateUpdated(state)
851
		if stateUpdateHandler[state] ~= nil then
852
			stateUpdateHandler[state]()
853
		end
854
		activeState = state
855
	end
856
	
857
	Humanoid.Died:connect(			function() stateUpdated(Enum.HumanoidStateType.Dead) 			end)
858
	Humanoid.Running:connect(		function() stateUpdated(Enum.HumanoidStateType.Running) 		end)
859
	Humanoid.Swimming:connect(		function() stateUpdated(Enum.HumanoidStateType.Swimming) 		end)
860
	Humanoid.Climbing:connect(		function() stateUpdated(Enum.HumanoidStateType.Climbing) 		end)
861
	Humanoid.Jumping:connect(		function() stateUpdated(Enum.HumanoidStateType.Jumping) 		end)
862
	Humanoid.GettingUp:connect(		function() stateUpdated(Enum.HumanoidStateType.GettingUp) 		end)
863
	Humanoid.FreeFalling:connect(		function() stateUpdated(Enum.HumanoidStateType.Freefall) 		end)
864
	Humanoid.FallingDown:connect(		function() stateUpdated(Enum.HumanoidStateType.FallingDown) 	end)
865
	
866
	-- required for proper handling of Landed event
867
	Humanoid.StateChanged:connect(function(old, new)
868
		stateUpdated(new)
869
	end)
870
	
871
	
872
	function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
873
		local stepScale = stepDeltaSeconds / tickSpeedSeconds
874
		do
875
			local sound = Sounds[SFX.FreeFalling]
876
			if activeState == Enum.HumanoidStateType.Freefall then
877
				if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
878
					Util.Resume(sound)
879
					
880
					--Volume takes 1.1 seconds to go from volume 0 to 1
881
					local ANIMATION_LENGTH_SECONDS = 1.1
882
					
883
					local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS									
884
					sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
885
				else
886
					sound.Volume = 0
887
				end			
888
			else
889
				Util.Pause(sound)
890
			end
891
		end
892
		
893
		do
894
			local sound = Sounds[SFX.Running]
895
			if activeState == Enum.HumanoidStateType.Running then
896
				if Util.HorizontalSpeed(Head) < 0.5 then
897
					Util.Pause(sound)
898
				end
899
			end
900
		end		
901
	end
902
	
903
	local lastTick = tick()
904
	local TICK_SPEED_SECONDS = 0.25
905
	while true do
906
		onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
907
		lastTick = tick()
908
		wait(TICK_SPEED_SECONDS)
909
	end
910
end
911
912
end,o34)
913
end))
914
o35.Name = "Respawn"
915
o35.Parent = o2
916
table.insert(cors,coroutine.create(function()
917
wait()
918
runDummyScript(function()
919
name="Humanoid"
920
921
robo=script.Parent:clone()
922
923
while true do
924
	wait(30)
925
	if script.Parent.Humanoid.Health<1 then
926
		robot=robo:clone()
927
		robot.Parent=script.Parent.Parent
928
		robot:makeJoints()
929
		script.Parent:remove()
930
	end
931
end
932
		
933
934
935
936
end,o35)
937
end))
938
o38.Name = "OriginalSize"
939
o38.Parent = mas
940
o38.Value = Vector3.new(0.804975927, 0.45631969, 1.21525145)
941
o39.Name = "LeftAnkle"
942
o39.Parent = mas
943
o39.C0 = CFrame.new(-0.0572988987, -0.554775834, 0.00460058777, 1, 0, 0, 0, 1, 0, 0, 0, 1)
944
o39.C1 = CFrame.new(-0.0572988093, -0.0541849136, 0.102052271, 1, 0, 0, 0, 1, 0, 0, 0, 1)
945
o39.Part0 = mas
946
o39.Part1 = mas
947
o48.Name = "OriginalSize"
948
o48.Parent = mas
949
o48.Value = Vector3.new(1.68052888, 0.508752942, 1.01567388)
950
o49.Name = "Root"
951
o49.Parent = mas
952
o49.C1 = CFrame.new(-5.66244125e-07, 0.0325828269, 0.0487938523, 1, 0, 0, 0, 1, 0, 0, 0, 1)
953
o49.Part0 = o3
954
o49.Part1 = mas
955
o60.Name = "OriginalSize"
956
o60.Parent = mas
957
o60.Value = Vector3.new(2.03200006, 1.86928844, 1.12989664)
958
o61.Name = "Waist"
959
o61.Parent = mas
960
o61.C0 = CFrame.new(-5.66244125e-07, 0.432582825, 0.0487938523, 1, 0, 0, 0, 1, 0, 0, 0, 1)
961
o61.C1 = CFrame.new(-4.17232513e-07, -0.415409416, 0.0607423484, 1, 0, 0, 0, 1, 0, 0, 0, 1)
962
o61.Part0 = mas
963
o61.Part1 = mas
964
o66.Name = "OriginalSize"
965
o66.Parent = mas
966
o66.Value = Vector3.new(0.675612688, 1.12489867, 0.826949)
967
o67.Name = "LeftShoulder"
968
o67.Parent = mas
969
o67.C0 = CFrame.new(-1.24989152, 0.584590554, 0.0607423484, 1, 0, 0, 0, 1, 0, 0, 0, 1)
970
o67.C1 = CFrame.new(0.0625219345, 0.288986444, -0.0245017558, 1, 0, 0, 0, 1, 0, 0, 0, 1)
971
o67.Part0 = mas
972
o67.Part1 = mas
973
o71.Name = "OriginalSize"
974
o71.Parent = mas
975
o71.Value = Vector3.new(0.678933978, 1.34023976, 0.838257849)
976
o72.Name = "RightHip"
977
o72.Parent = mas
978
o72.C0 = CFrame.new(0.499999434, -0.317417175, 0.0487938523, 1, 0, 0, 0, 1, 0, 0, 0, 1)
979
o72.C1 = CFrame.new(0.0572995543, 0.406759053, 0.0292846859, 1, 0, 0, 0, 1, 0, 0, 0, 1)
980
o72.Part0 = mas
981
o72.Part1 = mas
982
o77.Name = "OriginalSize"
983
o77.Parent = mas
984
o77.Value = Vector3.new(0.675612688, 1.12489867, 0.826949239)
985
o78.Name = "RightShoulder"
986
o78.Parent = mas
987
o78.C0 = CFrame.new(1.24997997, 0.584590554, 0.0607423484, 1, 0, 0, 0, 1, 0, 0, 0, 1)
988
o78.C1 = CFrame.new(-0.0624326468, 0.288986444, -0.0245021135, 1, 0, 0, 0, 1, 0, 0, 0, 1)
989
o78.Part0 = mas
990
o78.Part1 = mas
991
o82.Name = "OriginalSize"
992
o82.Parent = mas
993
o82.Value = Vector3.new(0.827857256, 0.925159216, 0.877025485)
994
o83.Name = "RightElbow"
995
o83.Parent = mas
996
o83.C0 = CFrame.new(0.187587023, -0.361013532, -0.0245021135, 1, 0, 0, 0, 1, 0, 0, 0, 1)
997
o83.C1 = CFrame.new(0.0363556147, 0.403800189, -0.00020223856, 1, 0, 0, 0, 1, 0, 0, 0, 1)
998
o83.Part0 = mas
999
o83.Part1 = mas
1000
o87.Name = "OriginalSize"
1001
o87.Parent = mas
1002
o87.Value = Vector3.new(0.722899377, 0.919740558, 0.897220731)
1003
o88.Name = "RightKnee"
1004
o88.Parent = mas
1005
o88.C0 = CFrame.new(0.0572995543, -0.393240929, 0.029328391, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1006
o88.C1 = CFrame.new(0.0572987497, 0.445221305, 0.00464349939, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1007
o88.Part0 = mas
1008
o88.Part1 = mas
1009
o92.Name = "OriginalSize"
1010
o92.Parent = mas
1011
o92.Value = Vector3.new(0.678933918, 1.34023976, 0.83825773)
1012
o93.Name = "LeftHip"
1013
o93.Parent = mas
1014
o93.C0 = CFrame.new(-0.500000596, -0.317417175, 0.0487938523, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1015
o93.C1 = CFrame.new(-0.0572995245, 0.406759053, 0.0292848647, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1016
o93.Part0 = mas
1017
o93.Part1 = mas
1018
o97.Name = "OriginalSize"
1019
o97.Parent = mas
1020
o97.Value = Vector3.new(0.722899318, 0.919740438, 0.897220731)
1021
o98.Name = "LeftKnee"
1022
o98.Parent = mas
1023
o98.C0 = CFrame.new(-0.0572995245, -0.393240929, 0.0292848647, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1024
o98.C1 = CFrame.new(-0.0572987199, 0.445221424, 0.00459977984, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1025
o98.Part0 = mas
1026
o98.Part1 = mas
1027
o101.Name = "OriginalSize"
1028
o101.Parent = mas
1029
o101.Value = Vector3.new(0.804975271, 0.456319809, 1.21525121)
1030
o102.Name = "RightAnkle"
1031
o102.Parent = mas
1032
o102.C0 = CFrame.new(0.0572987497, -0.554778814, 0.00469824811, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1033
o102.C1 = CFrame.new(0.0572986603, -0.0541877747, 0.102150455, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1034
o102.Part0 = mas
1035
o102.Part1 = mas
1036
o106.Name = "OriginalSize"
1037
o106.Parent = mas
1038
o106.Value = Vector3.new(0.827857256, 0.925159276, 0.877025366)
1039
o107.Name = "LeftElbow"
1040
o107.Parent = mas
1041
o107.C0 = CFrame.new(-0.187108159, -0.361013532, -0.0245017558, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1042
o107.C1 = CFrame.new(-0.0358767509, 0.40380016, -0.000202059746, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1043
o107.Part0 = mas
1044
o107.Part1 = mas
1045
o111.Name = "OriginalSize"
1046
o111.Parent = mas
1047
o111.Value = Vector3.new(0.775964022, 0.955060005, 0.760477781)
1048
o112.Name = "LeftWrist"
1049
o112.Parent = mas
1050
o112.C0 = CFrame.new(-0.0358767509, -0.396199822, -0.000202059746, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1051
o112.C1 = CFrame.new(0.0106925964, 0.110724702, -0.0063508749, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1052
o112.Part0 = mas
1053
o112.Part1 = mas
1054
o113.Name = "Damage Script"
1055
o113.Parent = mas
1056
table.insert(cors,coroutine.create(function()
1057
wait()
1058
runDummyScript(function()
1059
function onTouched(hit)
1060
        local human = hit.Parent:findFirstChild("Humanoid")
1061
        if (human ~= nil) then
1062
                human.Health = human.Health - 50 -- Change the amount to change the damage.
1063
        end
1064
end
1065
script.Parent.Touched:connect(onTouched)
1066
end,o113)
1067
end))
1068
o117.Name = "OriginalSize"
1069
o117.Parent = mas
1070
o117.Value = Vector3.new(0.775964022, 0.955060005, 0.760477781)
1071
o118.Name = "RightWrist"
1072
o118.Parent = mas
1073
o118.C0 = CFrame.new(0.0363556147, -0.396199793, -0.00020223856, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1074
o118.C1 = CFrame.new(-0.0102137327, 0.110724702, -0.00635111332, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1075
o118.Part0 = mas
1076
o118.Part1 = mas
1077
o119.Name = "Damage Script"
1078
o119.Parent = mas
1079
table.insert(cors,coroutine.create(function()
1080
wait()
1081
runDummyScript(function()
1082
function onTouched(hit)
1083
        local human = hit.Parent:findFirstChild("Humanoid")
1084
        if (human ~= nil) then
1085
                human.Health = human.Health - 50 -- Change the amount to change the damage.
1086
        end
1087
end
1088
script.Parent.Touched:connect(onTouched)
1089
end,o119)
1090
end))
1091
o120.Name = "Core"
1092
o120.Parent = o2
1093
table.insert(cors,coroutine.create(function()
1094
wait()
1095
runDummyScript(function()
1096
print("Hello world!")
1097
1098
Character = script.Parent
1099
Humanoid = Character.Humanoid
1100
Torso = Character.Torso
1101
1102
function OnDeath()
1103
	print("Death")
1104
x=Character:GetChildren()	
1105
		for i=1,#x do
1106
			if (x[i].className=="Tool") then
1107
			x[i].Parent = nil
1108
			end
1109
		end		
1110
	mode = Instance.new("Model")
1111
	mode.Name = ""
1112
	mode.Parent = Workspace
1113
    wait()
1114
    Humanoid.Parent = nil
1115
	THIS = script.Cleaner:clone()
1116
	THIS.Parent = mode
1117
	THIS.Disabled = false
1118
		bland=Instance.new("Humanoid")
1119
		bland.Health=0
1120
		bland.MaxHealth=0
1121
		bland.Parent=mode
1122
		--bland.Name = "Ragdoll"	
1123
	x=Character:GetChildren()	
1124
		for i=1,#x do
1125
			if (x[i].className=="Hat") then
1126
			x[i].Handle.Anchored = true	
1127
			end
1128
		if (x[i].className =="Part") then
1129
		x[i].Anchored = true
1130
		end	
1131
		end		
1132
	if Torso then
1133
		--Torso.Velocity = Vector3.new(0, 0, 0)
1134
		--Torso.RotVelocity = Vector3.new(0, 0, 0)
1135
		zam=Torso:Clone()
1136
		zam.Parent=mode
1137
		zam.Elasticity = 0
1138
		zam.Friction = 1
1139
		x=Character:GetChildren()	
1140
		for i=1,#x do
1141
		if ((x[i].Name=="Shirt") or (x[i].Name=="Pants") or (x[i].className=="CharacterMesh") or (x[i].className=="Hat") or (x[i].className=="Decal") or (x[i].className=="ShirtGraphic") or (x[i].className=="Model")) then
1142
			local zor=x[i]:Clone()
1143
			zor.Parent=mode
1144
		end
1145
		if x[i].Name=="Head" then
1146
			--x[i].Velocity = Vector3.new(0, 0, 0)
1147
			--x[i].RotVelocity = Vector3.new(0, 0, 0)
1148
			local zem=x[i]:Clone()
1149
			zem.Parent=mode
1150
			zem.Name="Head"
1151
			zem.Elasticity = 0
1152
			zem.Friction = 1
1153
			local Neck = Instance.new("Weld")
1154
			Neck.Name = "Neck"
1155
			Neck.Part0 = zam
1156
			Neck.Part1 = zem
1157
			Neck.C0 = CFrame.new(0, 1.5, 0)
1158
			Neck.C1 = CFrame.new()
1159
			Neck.Parent = zam
1160
		end
1161
		if x[i].Name=="Right Arm" then
1162
			--x[i].Velocity = Vector3.new(0, 0, 0)
1163
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
1164
			local Limb=x[i]:Clone()
1165
			Limb.Parent=mode
1166
			Limb.CFrame = zam.CFrame * CFrame.new(1.5, 0, 0)
1167
			Limb.Elasticity = 0
1168
			Limb.Friction = 1
1169
			local Joint = Instance.new("Rotate")
1170
			Joint.Name = "RightShoulder"
1171
			Joint.Part0 = zam
1172
			Joint.Part1 = Limb
1173
			Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1174
			Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1175
			Joint.Parent = zam
1176
1177
			local B = Instance.new("Part")
1178
			B.TopSurface = 0
1179
			B.BottomSurface = 0
1180
			B.Elasticity = 0
1181
			B.Friction = 1
1182
			B.formFactor = "Symmetric"
1183
			B.Size = Vector3.new(1, 1, 1)
1184
			B.Transparency = 1
1185
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
1186
			B.Parent = mode
1187
			local W = Instance.new("Weld")
1188
			W.Part0 = Limb
1189
			W.Part1 = B
1190
			W.C0 = CFrame.new(0, -0.5, 0)
1191
			W.Parent = Limb
1192
1193
		end
1194
		if x[i].Name=="Left Arm" then
1195
			--x[i].Velocity = Vector3.new(0, 0, 0)
1196
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
1197
			local Limb=x[i]:Clone()
1198
			Limb.Parent=mode
1199
			Limb.CFrame = zam.CFrame * CFrame.new(-1.5, 0, 0)
1200
			Limb.Elasticity = 0
1201
			Limb.Friction = 1
1202
			local Joint = Instance.new("Rotate")
1203
			Joint.Name = "LeftShoulder"
1204
			Joint.Part0 = zam
1205
			Joint.Part1 = Limb
1206
			Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1207
			Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1208
			Joint.Parent = zam
1209
1210
			local B = Instance.new("Part")
1211
			B.TopSurface = 0
1212
			B.BottomSurface = 0
1213
			B.Elasticity = 0
1214
			B.Friction = 1
1215
			B.formFactor = "Symmetric"
1216
			B.Size = Vector3.new(1, 1, 1)
1217
			B.Transparency = 1
1218
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
1219
			B.Parent = mode
1220
			local W = Instance.new("Weld")
1221
			W.Part0 = Limb
1222
			W.Part1 = B
1223
			W.C0 = CFrame.new(0, -0.5, 0)
1224
			W.Parent = Limb
1225
1226
		end
1227
		if x[i].Name=="Right Leg" then
1228
			--x[i].Velocity = Vector3.new(0, 0, 0)
1229
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
1230
			local Limb=x[i]:Clone()
1231
			Limb.Parent=mode
1232
			Limb.CFrame = zam.CFrame * CFrame.new(0.5, -2, 0)
1233
			Limb.Elasticity = 0
1234
			Limb.Friction = 1
1235
			local Joint = Instance.new("Rotate")
1236
			Joint.Name = "RightHip"
1237
			Joint.Part0 = zam
1238
			Joint.Part1 = Limb
1239
			Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1240
			Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
1241
			Joint.Parent = zam
1242
1243
			local B = Instance.new("Part")
1244
			B.TopSurface = 0
1245
			B.BottomSurface = 0
1246
			B.Elasticity = 0
1247
			B.Friction = 1
1248
			B.formFactor = "Symmetric"
1249
			B.Size = Vector3.new(1, 1, 1)
1250
			B.Transparency = 1
1251
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
1252
			B.Parent = mode
1253
			local W = Instance.new("Weld")
1254
			W.Part0 = Limb
1255
			W.Part1 = B
1256
			W.C0 = CFrame.new(0, -0.5, 0)
1257
			W.Parent = Limb
1258
1259
		end
1260
		if x[i].Name=="Left Leg" then
1261
			--x[i].Velocity = Vector3.new(0, 0, 0)
1262
			--x[i].RotVelocity = Vector3.new(0, 0, 0)			
1263
			local Limb=x[i]:Clone()
1264
			Limb.Parent=mode
1265
			Limb.CFrame = zam.CFrame * CFrame.new(-0.5, -2, 0)
1266
			Limb.Elasticity = 0
1267
			Limb.Friction = 1
1268
			local Joint = Instance.new("Rotate")
1269
			Joint.Name = "LeftHip"
1270
			Joint.Part0 = zam
1271
			Joint.Part1 = Limb
1272
			Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1273
			Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
1274
			Joint.Parent = zam
1275
1276
			local B = Instance.new("Part")
1277
			B.TopSurface = 0
1278
			B.BottomSurface = 0
1279
			B.Elasticity = 0
1280
			B.Friction = 1
1281
			B.formFactor = "Symmetric"
1282
			B.Size = Vector3.new(1, 1, 1)
1283
			B.Transparency = 1
1284
			B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
1285
			B.Parent = mode
1286
			local W = Instance.new("Weld")
1287
			W.Part0 = Limb
1288
			W.Part1 = B
1289
			W.C0 = CFrame.new(0, -0.5, 0)
1290
			W.Parent = Limb
1291
1292
		end
1293
		end
1294
		
1295
		local Bar = Instance.new("Part")
1296
		Bar.TopSurface = 0
1297
		Bar.BottomSurface = 0
1298
		Bar.Elasticity = 0
1299
		Bar.Friction = 1
1300
		Bar.formFactor = "Symmetric"
1301
		Bar.Size = Vector3.new(1, 1, 1)
1302
		Bar.Transparency = 1
1303
		Bar.CFrame = zam.CFrame * CFrame.new(0, 0.5, 0)
1304
		Bar.Parent = mode
1305
		local Weld = Instance.new("Weld")
1306
		Weld.Part0 = zam
1307
		Weld.Part1 = Bar
1308
		Weld.C0 = CFrame.new(0, 0.5, 0)
1309
		Weld.Parent = zam		
1310
	end
1311
	wait()
1312
	Character:remove()
1313
	mode:FindFirstChild("Head").Velocity = Vector3.new(0,0,0)
1314
	mode:FindFirstChild("Left Arm").Velocity = Vector3.new(0,0,0)
1315
	mode:FindFirstChild("Left Leg").Velocity = Vector3.new(0,0,0)
1316
	mode:FindFirstChild("Right Arm").Velocity = Vector3.new(0,0,0)
1317
	mode:FindFirstChild("Right Leg").Velocity = Vector3.new(0,0,0)
1318
	mode:FindFirstChild("Torso").Velocity = Vector3.new(0,0,0)	
1319
	x=mode:GetChildren()	
1320
		for i=1,#x do
1321
			if (x[i].className=="Hat") then
1322
				if x[i]:findFirstChild("Handle") then
1323
				x[i].Handle.Anchored = false
1324
				end
1325
			end
1326
		if (x[i].className =="Part") then
1327
		x[i].Anchored = false
1328
		end	
1329
		end	
1330
	local b = Instance.new("BodyPosition")
1331
	b.maxForce = Vector3.new(0, 3000, 0)
1332
	b.position = mode:findFirstChild("Torso").Position - Vector3.new(0, 25, 0)
1333
	b.Parent = mode:findFirstChild("Torso")
1334
	wait(5)
1335
		for i=1,#x do
1336
			if (x[i].className=="Hat") then
1337
				if x[i]:findFirstChild("Handle") then
1338
				x[i].Handle.Anchored = true
1339
				end
1340
			end
1341
		if (x[i].className =="Part") then
1342
		x[i].Anchored = true
1343
		end	
1344
		end		
1345
end
1346
1347
Humanoid.Died:connect(OnDeath)
1348
end,o120)
1349
end))
1350
o121.Name = "Cleaner"
1351
o121.Parent = o120
1352
o121.Disabled = true
1353
table.insert(cors,coroutine.create(function()
1354
wait()
1355
runDummyScript(function()
1356
wait(30) -- removes the raggy in 10 seconds.
1357
script.Parent:Destroy()
1358
end,o121)
1359
end))
1360
o122.Name = "Read me"
1361
o122.Parent = o2
1362
table.insert(cors,coroutine.create(function()
1363
wait()
1364
runDummyScript(function()
1365
--| Help for R15 model Zombie |--
1366
--
1367
-- To edit the zombie's damage go to LeftLowerArm/RightLowerArm > Damage Script > human.Health = human.Health - 5
1368
--                                                                                              Edit the number to whatever you'd like
1369
-- The player will recieve damage from the LeftLowerArm and RightLowerArm
1370
-- To edit the walkspeed go to Humanoid > Scroll to the bottom > Edit the number shown after WalkSpeed
1371
-- You can also edit max health and spawn health under Humanoid > game
1372
--
1373
-- Have fun!
1374
--
1375
-- ImFarAway
1376
end,o122)
1377
end))
1378
o123.Parent = o2
1379
o123.Material = Enum.Material.Neon
1380
o123.BrickColor = BrickColor.new("Really red")
1381
o123.Position = Vector3.new(-5.77007198, 4.67999554, -11.1297207)
1382
o123.CanCollide = false
1383
o123.Shape = Enum.PartType.Ball
1384
o123.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
1385
o123.CFrame = CFrame.new(-5.77007198, 4.67999554, -11.1297207, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1386
o123.BottomSurface = Enum.SurfaceType.Smooth
1387
o123.TopSurface = Enum.SurfaceType.Smooth
1388
o123.Color = Color3.new(1, 0, 0)
1389
o123.Position = Vector3.new(-5.77007198, 4.67999554, -11.1297207)
1390
o124.Parent = o2
1391
o124.Material = Enum.Material.Neon
1392
o124.BrickColor = BrickColor.new("Really red")
1393
o124.Position = Vector3.new(-5.69007015, 4.67999554, -11.5097237)
1394
o124.CanCollide = false
1395
o124.Shape = Enum.PartType.Ball
1396
o124.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003)
1397
o124.CFrame = CFrame.new(-5.69007015, 4.67999554, -11.5097237, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1398
o124.BottomSurface = Enum.SurfaceType.Smooth
1399
o124.TopSurface = Enum.SurfaceType.Smooth
1400
o124.Color = Color3.new(1, 0, 0)
1401
o124.Position = Vector3.new(-5.69007015, 4.67999554, -11.5097237)
1402
o125.Name = "Animate"
1403
o125.Parent = o2
1404
table.insert(cors,coroutine.create(function()
1405
wait()
1406
runDummyScript(function()
1407
function   waitForChild(parent, childName)
1408
	local child = parent:findFirstChild(childName)
1409
	if child then return child end
1410
	while true do
1411
		child = parent.ChildAdded:wait()
1412
		if child.Name==childName then return child end
1413
	end
1414
end
1415
1416
local Figure = script.Parent
1417
local Humanoid = waitForChild(Figure, "Humanoid")
1418
local pose = "Standing"
1419
1420
local currentAnim = ""
1421
local currentAnimInstance = nil
1422
local currentAnimTrack = nil
1423
local currentAnimKeyframeHandler = nil
1424
local currentAnimSpeed = 0.5
1425
local animTable = {}
1426
local animNames = { 
1427
	idle = 	{	
1428
				{ id = "http://www.roblox.com/asset/?id=865721441", weight = 1 },
1429
				{ id = "http://www.roblox.com/asset/?id=865721441", weight = 9 }
1430
			},
1431
	walk = 	{ 	
1432
				{ id = "http://www.roblox.com/asset/?id=865719063", weight = 5 } 
1433
			}, 
1434
	run = 	{
1435
				{ id = "http://www.roblox.com/asset/?id=865719063", weight = 5 } 
1436
			}, 
1437
	swim = 	{
1438
				{ id = "http://www.roblox.com/asset/?id=507784897", weight = 10 } 
1439
			}, 
1440
	swimidle = 	{
1441
				{ id = "http://www.roblox.com/asset/?id=507785072", weight = 10 } 
1442
			}, 
1443
	jump = 	{
1444
				{ id = "http://www.roblox.com/asset/?id=507765000", weight = 10 } 
1445
			}, 
1446
	fall = 	{
1447
				{ id = "http://www.roblox.com/asset/?id=507767968", weight = 10 } 
1448
			}, 
1449
	climb = {
1450
				{ id = "http://www.roblox.com/asset/?id=507765644", weight = 10 } 
1451
			}, 
1452
	sit = 	{
1453
				{ id = "http://www.roblox.com/asset/?id=507768133", weight = 10 } 
1454
			},	
1455
	toolnone = {
1456
				{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } 
1457
			},
1458
	toolslash = {
1459
				{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } 
1460
--				{ id = "slash.xml", weight = 10 } 
1461
			},
1462
	toollunge = {
1463
				{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } 
1464
			},
1465
	wave = {
1466
				{ id = "http://www.roblox.com/asset/?id=507770239", weight = 10 } 
1467
			},
1468
	point = {
1469
				{ id = "http://www.roblox.com/asset/?id=507770453", weight = 10 } 
1470
			},
1471
	dance = {
1472
				{ id = "http://www.roblox.com/asset/?id=507771019", weight = 10 }, 
1473
				{ id = "http://www.roblox.com/asset/?id=507771955", weight = 10 }, 
1474
				{ id = "http://www.roblox.com/asset/?id=507772104", weight = 10 } 
1475
			},
1476
	dance2 = {
1477
				{ id = "http://www.roblox.com/asset/?id=507776043", weight = 10 }, 
1478
				{ id = "http://www.roblox.com/asset/?id=507776720", weight = 10 }, 
1479
				{ id = "http://www.roblox.com/asset/?id=507776879", weight = 10 } 
1480
			},
1481
	dance3 = {
1482
				{ id = "http://www.roblox.com/asset/?id=507777268", weight = 10 }, 
1483
				{ id = "http://www.roblox.com/asset/?id=507777451", weight = 10 }, 
1484
				{ id = "http://www.roblox.com/asset/?id=507777623", weight = 10 } 
1485
			},
1486
	laugh = {
1487
				{ id = "http://www.roblox.com/asset/?id=507770818", weight = 10 } 
1488
			},
1489
	cheer = {
1490
				{ id = "http://www.roblox.com/asset/?id=507770677", weight = 10 } 
1491
			},
1492
}
1493
1494
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
1495
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
1496
1497
math.randomseed(tick())
1498
1499
function configureAnimationSet(name, fileList)
1500
	if (animTable[name] ~= nil) then
1501
		for _, connection in pairs(animTable[name].connections) do
1502
			connection:disconnect()
1503
		end
1504
	end
1505
	animTable[name] = {}
1506
	animTable[name].count = 0
1507
	animTable[name].totalWeight = 0	
1508
	animTable[name].connections = {}
1509
1510
	-- check for config values
1511
	local config = script:FindFirstChild(name)
1512
	if (config ~= nil) then
1513
--		print("Loading anims " .. name)
1514
		table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
1515
		table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
1516
		local idx = 1
1517
		for _, childPart in pairs(config:GetChildren()) do
1518
			if (childPart:IsA("Animation")) then
1519
				table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
1520
				animTable[name][idx] = {}
1521
				animTable[name][idx].anim = childPart
1522
				local weightObject = childPart:FindFirstChild("Weight")
1523
				if (weightObject == nil) then
1524
					animTable[name][idx].weight = 1
1525
				else
1526
					animTable[name][idx].weight = weightObject.Value
1527
				end
1528
				animTable[name].count = animTable[name].count + 1
1529
				animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
1530
--				print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
1531
				idx = idx + 1
1532
			end
1533
		end
1534
	end
1535
1536
	-- fallback to defaults
1537
	if (animTable[name].count <= 0) then
1538
		for idx, anim in pairs(fileList) do
1539
			animTable[name][idx] = {}
1540
			animTable[name][idx].anim = Instance.new("Animation")
1541
			animTable[name][idx].anim.Name = name
1542
			animTable[name][idx].anim.AnimationId = anim.id
1543
			animTable[name][idx].weight = anim.weight
1544
			animTable[name].count = animTable[name].count + 1
1545
			animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
1546
--			print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
1547
		end
1548
	end
1549
end
1550
1551
-- Setup animation objects
1552
function scriptChildModified(child)
1553
	local fileList = animNames[child.Name]
1554
	if (fileList ~= nil) then
1555
		configureAnimationSet(child.Name, fileList)
1556
	end	
1557
end
1558
1559
script.ChildAdded:connect(scriptChildModified)
1560
script.ChildRemoved:connect(scriptChildModified)
1561
1562
1563
for name, fileList in pairs(animNames) do 
1564
	configureAnimationSet(name, fileList)
1565
end	
1566
1567
-- ANIMATION
1568
1569
-- declarations
1570
local toolAnim = "None"
1571
local toolAnimTime = 0
1572
1573
local jumpAnimTime = 0
1574
local jumpAnimDuration = 0.31
1575
1576
local toolTransitionTime = 0.1
1577
local fallTransitionTime = 0.2
1578
1579
-- functions
1580
1581
function stopAllAnimations()
1582
	local oldAnim = currentAnim
1583
1584
	-- return to idle if finishing an emote
1585
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
1586
		oldAnim = "idle"
1587
	end
1588
1589
	currentAnim = ""
1590
	currentAnimInstance = nil
1591
	if (currentAnimKeyframeHandler ~= nil) then
1592
		currentAnimKeyframeHandler:disconnect()
1593
	end
1594
1595
	if (currentAnimTrack ~= nil) then
1596
		currentAnimTrack:Stop()
1597
		currentAnimTrack:Destroy()
1598
		currentAnimTrack = nil
1599
	end
1600
	return oldAnim
1601
end
1602
1603
function setAnimationSpeed(speed)
1604
	if speed ~= currentAnimSpeed then
1605
		currentAnimSpeed = speed
1606
		currentAnimTrack:AdjustSpeed(currentAnimSpeed)
1607
	end
1608
end
1609
1610
function keyFrameReachedFunc(frameName)
1611
	if (frameName == "End") then
1612
--		print("Keyframe : ".. frameName)
1613
1614
		local repeatAnim = currentAnim
1615
		-- return to idle if finishing an emote
1616
		if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
1617
			repeatAnim = "idle"
1618
		end
1619
		
1620
		local animSpeed = currentAnimSpeed
1621
		playAnimation(repeatAnim, 0.15, Humanoid)
1622
		setAnimationSpeed(animSpeed)
1623
	end
1624
end
1625
1626
-- Preload animations
1627
function playAnimation(animName, transitionTime, humanoid) 
1628
		
1629
	local roll = math.random(1, animTable[animName].totalWeight) 
1630
	local origRoll = roll
1631
	local idx = 1
1632
	while (roll > animTable[animName][idx].weight) do
1633
		roll = roll - animTable[animName][idx].weight
1634
		idx = idx + 1
1635
	end
1636
	
1637
--	print(animName .. " " .. idx .. " [" .. origRoll .. "]")
1638
	
1639
	local anim = animTable[animName][idx].anim
1640
1641
	-- switch animation		
1642
	if (anim ~= currentAnimInstance) then
1643
		
1644
		if (currentAnimTrack ~= nil) then
1645
			currentAnimTrack:Stop(transitionTime)
1646
			currentAnimTrack:Destroy()
1647
		end
1648
1649
		currentAnimSpeed = 1.0
1650
	
1651
		-- load it to the humanoid; get AnimationTrack
1652
		currentAnimTrack = humanoid:LoadAnimation(anim)
1653
		 
1654
		-- play the animation
1655
		currentAnimTrack:Play(transitionTime)
1656
		currentAnim = animName
1657
		currentAnimInstance = anim
1658
1659
		-- set up keyframe name triggers
1660
		if (currentAnimKeyframeHandler ~= nil) then
1661
			currentAnimKeyframeHandler:disconnect()
1662
		end
1663
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
1664
		
1665
	end
1666
1667
end
1668
1669
-------------------------------------------------------------------------------------------
1670
-------------------------------------------------------------------------------------------
1671
1672
local toolAnimName = ""
1673
local toolAnimTrack = nil
1674
local toolAnimInstance = nil
1675
local currentToolAnimKeyframeHandler = nil
1676
1677
function toolKeyFrameReachedFunc(frameName)
1678
	if (frameName == "End") then
1679
--		print("Keyframe : ".. frameName)	
1680
		playToolAnimation(toolAnimName, 0.0, Humanoid)
1681
	end
1682
end
1683
1684
1685
function playToolAnimation(animName, transitionTime, humanoid)	 
1686
		
1687
		local roll = math.random(1, animTable[animName].totalWeight) 
1688
		local origRoll = roll
1689
		local idx = 1
1690
		while (roll > animTable[animName][idx].weight) do
1691
			roll = roll - animTable[animName][idx].weight
1692
			idx = idx + 1
1693
		end
1694
--		print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
1695
		local anim = animTable[animName][idx].anim
1696
1697
		if (toolAnimInstance ~= anim) then
1698
			
1699
			if (toolAnimTrack ~= nil) then
1700
				toolAnimTrack:Stop()
1701
				toolAnimTrack:Destroy()
1702
				transitionTime = 0
1703
			end
1704
					
1705
			-- load it to the humanoid; get AnimationTrack
1706
			toolAnimTrack = humanoid:LoadAnimation(anim)
1707
			 
1708
			-- play the animation
1709
			toolAnimTrack:Play(transitionTime)
1710
			toolAnimName = animName
1711
			toolAnimInstance = anim
1712
1713
			currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
1714
		end
1715
end
1716
1717
function stopToolAnimations()
1718
	local oldAnim = toolAnimName
1719
1720
	if (currentToolAnimKeyframeHandler ~= nil) then
1721
		currentToolAnimKeyframeHandler:disconnect()
1722
	end
1723
1724
	toolAnimName = ""
1725
	toolAnimInstance = nil
1726
	if (toolAnimTrack ~= nil) then
1727
		toolAnimTrack:Stop()
1728
		toolAnimTrack:Destroy()
1729
		toolAnimTrack = nil
1730
	end
1731
1732
1733
	return oldAnim
1734
end
1735
1736
-------------------------------------------------------------------------------------------
1737
-------------------------------------------------------------------------------------------
1738
1739
1740
function onRunning(speed)
1741
	if speed > 0.01 then
1742
		local scale = 15.0
1743
		playAnimation("walk", 0.1, Humanoid)
1744
		setAnimationSpeed(speed / scale)
1745
		pose = "Running"
1746
	else
1747
		playAnimation("idle", 0.1, Humanoid)
1748
		pose = "Standing"
1749
	end
1750
end
1751
1752
function onDied()
1753
	pose = "Dead"
1754
end
1755
1756
function onJumping()
1757
	playAnimation("jump", 0.1, Humanoid)
1758
	jumpAnimTime = jumpAnimDuration
1759
	pose = "Jumping"
1760
end
1761
1762
function onClimbing(speed)
1763
	local scale = 5.0
1764
	playAnimation("climb", 0.1, Humanoid)
1765
	setAnimationSpeed(speed / scale)
1766
	pose = "Climbing"
1767
end
1768
1769
function onGettingUp()
1770
	pose = "GettingUp"
1771
end
1772
1773
function onFreeFall()
1774
	if (jumpAnimTime <= 0) then
1775
		playAnimation("fall", fallTransitionTime, Humanoid)
1776
	end
1777
	pose = "FreeFall"
1778
end
1779
1780
function onFallingDown()
1781
	pose = "FallingDown"
1782
end
1783
1784
function onSeated()
1785
	pose = "Seated"
1786
end
1787
1788
function onPlatformStanding()
1789
	pose = "PlatformStanding"
1790
end
1791
1792
function onSwimming(speed)
1793
	if speed > 1.00 then
1794
		local scale = 10.0
1795
		playAnimation("swim", 0.4, Humanoid)
1796
		setAnimationSpeed(speed / scale)
1797
		pose = "Swimming"
1798
	else
1799
		playAnimation("swimidle", 0.4, Humanoid)
1800
		pose = "Standing"
1801
	end
1802
end
1803
1804
function getTool()	
1805
	for _, kid in ipairs(Figure:GetChildren()) do
1806
		if kid.className == "Tool" then return kid end
1807
	end
1808
	return nil
1809
end
1810
1811
function getToolAnim(tool)
1812
	for _, c in ipairs(tool:GetChildren()) do
1813
		if c.Name == "toolanim" and c.className == "StringValue" then
1814
			return c
1815
		end
1816
	end
1817
	return nil
1818
end
1819
1820
function animateTool()
1821
	
1822
	if (toolAnim == "None") then
1823
		playToolAnimation("toolnone", toolTransitionTime, Humanoid)
1824
		return
1825
	end
1826
1827
	if (toolAnim == "Slash") then
1828
		playToolAnimation("toolslash", 0, Humanoid)
1829
		return
1830
	end
1831
1832
	if (toolAnim == "Lunge") then
1833
		playToolAnimation("toollunge", 0, Humanoid)
1834
		return
1835
	end
1836
end
1837
1838
function moveSit()
1839
	RightShoulder.MaxVelocity = 0.15
1840
	LeftShoulder.MaxVelocity = 0.15
1841
	RightShoulder:SetDesiredAngle(3.14 /2)
1842
	LeftShoulder:SetDesiredAngle(-3.14 /2)
1843
	RightHip:SetDesiredAngle(3.14 /2)
1844
	LeftHip:SetDesiredAngle(-3.14 /2)
1845
end
1846
1847
local lastTick = 0
1848
1849
function move(time)
1850
	local amplitude = 1
1851
	local frequency = 1
1852
  	local deltaTime = time - lastTick
1853
  	lastTick = time
1854
1855
	local climbFudge = 0
1856
	local setAngles = false
1857
1858
  	if (jumpAnimTime > 0) then
1859
  		jumpAnimTime = jumpAnimTime - deltaTime
1860
  	end
1861
1862
	if (pose == "FreeFall" and jumpAnimTime <= 0) then
1863
		playAnimation("fall", fallTransitionTime, Humanoid)
1864
	elseif (pose == "Seated") then
1865
		playAnimation("sit", 0.5, Humanoid)
1866
		return
1867
	elseif (pose == "Running") then
1868
		playAnimation("walk", 0.1, Humanoid)
1869
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
1870
		stopAllAnimations()
1871
		amplitude = 0.1
1872
		frequency = 1
1873
		setAngles = true
1874
	end
1875
1876
	-- Tool Animation handling
1877
	local tool = getTool()
1878
	if tool then
1879
	
1880
		animStringValueObject = getToolAnim(tool)
1881
1882
		if animStringValueObject then
1883
			toolAnim = animStringValueObject.Value
1884
			-- message recieved, delete StringValue
1885
			animStringValueObject.Parent = nil
1886
			toolAnimTime = time + .3
1887
		end
1888
1889
		if time > toolAnimTime then
1890
			toolAnimTime = 0
1891
			toolAnim = "None"
1892
		end
1893
1894
		animateTool()		
1895
	else
1896
		stopToolAnimations()
1897
		toolAnim = "None"
1898
		toolAnimInstance = nil
1899
		toolAnimTime = 0
1900
	end
1901
end
1902
1903
-- connect events
1904
Humanoid.Died:connect(onDied)
1905
Humanoid.Running:connect(onRunning)
1906
Humanoid.Jumping:connect(onJumping)
1907
Humanoid.Climbing:connect(onClimbing)
1908
Humanoid.GettingUp:connect(onGettingUp)
1909
Humanoid.FreeFalling:connect(onFreeFall)
1910
Humanoid.FallingDown:connect(onFallingDown)
1911
Humanoid.Seated:connect(onSeated)
1912
Humanoid.PlatformStanding:connect(onPlatformStanding)
1913
Humanoid.Swimming:connect(onSwimming)
1914
1915
-- setup emote chat hook
1916
script.msg.Changed:connect(function(msg)
1917
	script.msg.Value = ""
1918
	local emote = ""
1919
	if (string.sub(msg, 1, 3) == "/e ") then
1920
		emote = string.sub(msg, 4)
1921
	elseif (string.sub(msg, 1, 7) == "/emote ") then
1922
		emote = string.sub(msg, 8)
1923
	end
1924
	
1925
	if (pose == "Standing" and emoteNames[emote] ~= nil) then
1926
		playAnimation(emote, 0.1, Humanoid)
1927
	end
1928
--	print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
1929
end)
1930
1931
1932
-- main program
1933
1934
local runService = game:service("RunService");
1935
1936
-- print("bottom")
1937
1938
-- initialize to idle
1939
playAnimation("idle", 0.1, Humanoid)
1940
pose = "Standing"
1941
1942
while Figure.Parent~=nil do
1943
	local _, time = wait(0.1)
1944
	move(time)
1945
end
1946
1947
1948
1949
end,o125)
1950
end))
1951
o126.Name = "msg"
1952
o126.Parent = o125
1953
o127.Name = "climb"
1954
o127.Parent = o125
1955
o128.Name = "ClimbAnim"
1956
o128.Parent = o127
1957
o128.AnimationId = "http://www.roblox.com/asset/?id=507765644"
1958
o129.Name = "idle"
1959
o129.Parent = o125
1960
o130.Name = "sit"
1961
o130.Parent = o125
1962
o131.Name = "SitAnim"
1963
o131.Parent = o130
1964
o131.AnimationId = "http://www.roblox.com/asset/?id=507768133"
1965
o132.Name = "swim"
1966
o132.Parent = o125
1967
o133.Name = "Swim"
1968
o133.Parent = o132
1969
o133.AnimationId = "http://www.roblox.com/asset/?id=507784897"
1970
o134.Name = "swimidle"
1971
o134.Parent = o125
1972
o135.Name = "SwimIdle"
1973
o135.Parent = o134
1974
o135.AnimationId = "http://www.roblox.com/asset/?id=481825862"
1975
o136.Name = "toolnone"
1976
o136.Parent = o125
1977
o137.Name = "ToolNoneAnim"
1978
o137.Parent = o136
1979
o137.AnimationId = "http://www.roblox.com/asset/?id=507768375"
1980
o138.Name = "walk"
1981
o138.Parent = o125
1982
o139.Name = "fall"
1983
o139.Parent = o125
1984
o140.Name = "FallAnim"
1985
o140.Parent = o139
1986
o140.AnimationId = "http://www.roblox.com/asset/?id=616157476"
1987
o141.Name = "jump"
1988
o141.Parent = o125
1989
o142.Name = "JumpAnim"
1990
o142.Parent = o141
1991
o142.AnimationId = "http://www.roblox.com/asset/?id=616161997"
1992
o143.Name = "Read Me"
1993
o143.Parent = o2
1994
table.insert(cors,coroutine.create(function()
1995
wait()
1996
runDummyScript(function()
1997
--(This Enemy can pass through soild object and will pass through the ground you can change it if you want, also it 
1998
--kill any thing that it touch)it only dose 50 damage but it still kills like that you can change the damage
1999
--by going to the left ans right hands
2000
--
2001
2002
2003
end,o143)
2004
end))
2005
mas.Parent = workspace
2006
mas:MakeJoints()
2007
local mas1 = mas:GetChildren()
2008
for i=1,#mas1 do
2009
	mas1[i].Parent = workspace 
2010
	ypcall(function() mas1[i]:MakeJoints() end)
2011
end
2012
mas:Destroy()
2013
for i=1,#cors do
2014
coroutine.resume(cors[i])
2015
end
2016
2017
game:GetService("Lighting").Ambient = Color3.new(0, 0, 0)
2018
game:GetService("Lighting").Brightness = 1
2019
game:GetService("Lighting").ColorShift_Bottom = Color3.new(0, 0, 0)
2020
game:GetService("Lighting").ColorShift_Top = Color3.new(0, 0, 0)
2021
game:GetService("Lighting").GlobalShadows = true
2022
game:GetService("Lighting").OutdoorAmbient = Color3.new(0.5, 0.5, 0.5)
2023
game:GetService("Lighting").Outlines = false
2024
game:GetService("Lighting").GeographicLatitude = 41.733299255371
2025
game:GetService("Lighting").TimeOfDay = "14:00:00"
2026
game:GetService("Lighting").FogColor = Color3.new(0.75, 0.75, 0.75)
2027
game:GetService("Lighting").FogEnd = 100000
2028
game:GetService("Lighting").FogStart = 0