View difference between Paste ID: VxzxM1a6 and 5FG51pGc
SHOW: | | - or go back to the newest paste.
1
2
--Converted with ttyyuu12345's model to script plugin v4
3
function sandbox(var,func)
4
	local env = getfenv(func)
5
	local newenv = setmetatable({},{
6
		__index = function(self,k)
7
			if k=="script" then
8
				return var
9
			else
10
				return env[k]
11
			end
12
		end,
13
	})
14
	setfenv(func,newenv)
15
	return func
16
end
17
cors = {}
18
mas = Instance.new("Model",game:GetService("Lighting"))
19
Model0 = Instance.new("Model")
20-
Part1 = Instance.new("Part")
20+
Script1 = Instance.new("Script")
21-
SpecialMesh2 = Instance.new("SpecialMesh")
21+
Sound2 = Instance.new("Sound")
22-
Weld3 = Instance.new("Weld")
22+
MeshPart3 = Instance.new("MeshPart")
23-
Decal4 = Instance.new("Decal")
23+
Vector3Value4 = Instance.new("Vector3Value")
24-
Sound5 = Instance.new("Sound")
24+
Script5 = Instance.new("Script")
25-
PitchShiftSoundEffect6 = Instance.new("PitchShiftSoundEffect")
25+
Script6 = Instance.new("Script")
26-
Part7 = Instance.new("Part")
26+
Script7 = Instance.new("Script")
27-
Part8 = Instance.new("Part")
27+
Motor6D8 = Instance.new("Motor6D")
28-
Part9 = Instance.new("Part")
28+
MeshPart9 = Instance.new("MeshPart")
29-
Humanoid10 = Instance.new("Humanoid")
29+
Vector3Value10 = Instance.new("Vector3Value")
30
Script11 = Instance.new("Script")
31-
Part12 = Instance.new("Part")
31+
Script12 = Instance.new("Script")
32-
SpecialMesh13 = Instance.new("SpecialMesh")
32+
Motor6D13 = Instance.new("Motor6D")
33-
Part14 = Instance.new("Part")
33+
MeshPart14 = Instance.new("MeshPart")
34-
Part15 = Instance.new("Part")
34+
Vector3Value15 = Instance.new("Vector3Value")
35-
Part16 = Instance.new("Part")
35+
Motor6D16 = Instance.new("Motor6D")
36-
Shirt17 = Instance.new("Shirt")
36+
MeshPart17 = Instance.new("MeshPart")
37-
Pants18 = Instance.new("Pants")
37+
Vector3Value18 = Instance.new("Vector3Value")
38-
Part19 = Instance.new("Part")
38+
Motor6D19 = Instance.new("Motor6D")
39-
Fire20 = Instance.new("Fire")
39+
MeshPart20 = Instance.new("MeshPart")
40-
Model0.Name = "Sans"
40+
Vector3Value21 = Instance.new("Vector3Value")
41
Motor6D22 = Instance.new("Motor6D")
42-
Part1.Name = "Hea"
42+
MeshPart23 = Instance.new("MeshPart")
43-
Part1.Parent = Model0
43+
Vector3Value24 = Instance.new("Vector3Value")
44-
Part1.CFrame = CFrame.new(-69.4000015, 4.49995708, 79.4000015, 0, 0, -1, 0, 1, 0, 1, 0, 0)
44+
Script25 = Instance.new("Script")
45-
Part1.Orientation = Vector3.new(0, -90, 0)
45+
Script26 = Instance.new("Script")
46-
Part1.Position = Vector3.new(-69.4000015, 4.49995708, 79.4000015)
46+
Motor6D27 = Instance.new("Motor6D")
47-
Part1.Rotation = Vector3.new(0, -90, 0)
47+
Script28 = Instance.new("Script")
48-
Part1.Color = Color3.new(0.972549, 0.972549, 0.972549)
48+
MeshPart29 = Instance.new("MeshPart")
49-
Part1.Size = Vector3.new(2, 1, 1)
49+
Vector3Value30 = Instance.new("Vector3Value")
50-
Part1.Anchored = true
50+
Script31 = Instance.new("Script")
51-
Part1.BottomSurface = Enum.SurfaceType.Smooth
51+
Script32 = Instance.new("Script")
52-
Part1.BrickColor = BrickColor.new("Institutional white")
52+
Script33 = Instance.new("Script")
53-
Part1.TopSurface = Enum.SurfaceType.Smooth
53+
Motor6D34 = Instance.new("Motor6D")
54-
Part1.brickColor = BrickColor.new("Institutional white")
54+
MeshPart35 = Instance.new("MeshPart")
55-
Part1.FormFactor = Enum.FormFactor.Symmetric
55+
Vector3Value36 = Instance.new("Vector3Value")
56-
Part1.formFactor = Enum.FormFactor.Symmetric
56+
Script37 = Instance.new("Script")
57-
SpecialMesh2.Parent = Part1
57+
Script38 = Instance.new("Script")
58-
SpecialMesh2.Scale = Vector3.new(1.25, 1.25, 1.25)
58+
Script39 = Instance.new("Script")
59-
Weld3.Parent = Part1
59+
Motor6D40 = Instance.new("Motor6D")
60-
Weld3.C0 = CFrame.new(0, -1.5, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
60+
MeshPart41 = Instance.new("MeshPart")
61-
Decal4.Parent = Part1
61+
Vector3Value42 = Instance.new("Vector3Value")
62-
Decal4.Texture = "http://www.roblox.com/asset/?id=416805592"
62+
Script43 = Instance.new("Script")
63-
Sound5.Parent = Part1
63+
Script44 = Instance.new("Script")
64-
Sound5.Looped = true
64+
Motor6D45 = Instance.new("Motor6D")
65-
Sound5.MaxDistance = 100
65+
MeshPart46 = Instance.new("MeshPart")
66-
Sound5.Playing = true
66+
Vector3Value47 = Instance.new("Vector3Value")
67-
Sound5.SoundId = "rbxassetid://395780625"
67+
Motor6D48 = Instance.new("Motor6D")
68-
Sound5.Volume = 6
68+
MeshPart49 = Instance.new("MeshPart")
69-
PitchShiftSoundEffect6.Parent = Sound5
69+
Vector3Value50 = Instance.new("Vector3Value")
70-
PitchShiftSoundEffect6.Octave = 1.2000000476837
70+
Motor6D51 = Instance.new("Motor6D")
71-
Part7.Name = "Torso"
71+
MeshPart52 = Instance.new("MeshPart")
72-
Part7.Parent = Model0
72+
Vector3Value53 = Instance.new("Vector3Value")
73-
Part7.CFrame = CFrame.new(-69.4000015, 2.999964, 79.4000015, 0, 0, -1, 0, 1, 0, 1, 0, 0)
73+
Motor6D54 = Instance.new("Motor6D")
74-
Part7.Orientation = Vector3.new(0, -90, 0)
74+
IntValue55 = Instance.new("IntValue")
75-
Part7.Position = Vector3.new(-69.4000015, 2.999964, 79.4000015)
75+
Humanoid56 = Instance.new("Humanoid")
76-
Part7.Rotation = Vector3.new(0, -90, 0)
76+
MeshPart57 = Instance.new("MeshPart")
77-
Part7.Color = Color3.new(0.972549, 0.972549, 0.972549)
77+
Vector3Value58 = Instance.new("Vector3Value")
78-
Part7.Size = Vector3.new(2, 2, 1)
78+
Script59 = Instance.new("Script")
79-
Part7.Anchored = true
79+
Script60 = Instance.new("Script")
80-
Part7.BottomSurface = Enum.SurfaceType.Smooth
80+
Script61 = Instance.new("Script")
81-
Part7.BrickColor = BrickColor.new("Institutional white")
81+
Motor6D62 = Instance.new("Motor6D")
82-
Part7.LeftParamA = 0
82+
Script63 = Instance.new("Script")
83-
Part7.LeftParamB = 0
83+
Part64 = Instance.new("Part")
84-
Part7.RightParamA = 0
84+
Vector3Value65 = Instance.new("Vector3Value")
85-
Part7.RightParamB = 0
85+
Script66 = Instance.new("Script")
86-
Part7.TopSurface = Enum.SurfaceType.Smooth
86+
Script67 = Instance.new("Script")
87-
Part7.brickColor = BrickColor.new("Institutional white")
87+
Part68 = Instance.new("Part")
88-
Part7.FormFactor = Enum.FormFactor.Symmetric
88+
Script69 = Instance.new("Script")
89-
Part7.formFactor = Enum.FormFactor.Symmetric
89+
ScreenGui70 = Instance.new("ScreenGui")
90-
Part8.Name = "Left Leg"
90+
Frame71 = Instance.new("Frame")
91-
Part8.Parent = Model0
91+
ImageLabel72 = Instance.new("ImageLabel")
92-
Part8.CFrame = CFrame.new(-69.4000015, 1.00000405, 78.9000015, 0, 0, -1, 0, 1, 0, 1, 0, 0)
92+
Sound73 = Instance.new("Sound")
93-
Part8.Orientation = Vector3.new(0, -90, 0)
93+
Script74 = Instance.new("Script")
94-
Part8.Position = Vector3.new(-69.4000015, 1.00000405, 78.9000015)
94+
Part75 = Instance.new("Part")
95-
Part8.Rotation = Vector3.new(0, -90, 0)
95+
Vector3Value76 = Instance.new("Vector3Value")
96-
Part8.Color = Color3.new(0.972549, 0.972549, 0.972549)
96+
Script77 = Instance.new("Script")
97-
Part8.Size = Vector3.new(1, 2, 1)
97+
Script78 = Instance.new("Script")
98-
Part8.Anchored = true
98+
SpecialMesh79 = Instance.new("SpecialMesh")
99-
Part8.BottomSurface = Enum.SurfaceType.Smooth
99+
Motor6D80 = Instance.new("Motor6D")
100-
Part8.BrickColor = BrickColor.new("Institutional white")
100+
Script81 = Instance.new("Script")
101-
Part8.TopSurface = Enum.SurfaceType.Smooth
101+
Script82 = Instance.new("Script")
102-
Part8.brickColor = BrickColor.new("Institutional white")
102+
Script83 = Instance.new("Script")
103-
Part8.FormFactor = Enum.FormFactor.Symmetric
103+
StringValue84 = Instance.new("StringValue")
104-
Part8.formFactor = Enum.FormFactor.Symmetric
104+
Animation85 = Instance.new("Animation")
105-
Part9.Name = "Right Leg"
105+
StringValue86 = Instance.new("StringValue")
106-
Part9.Parent = Model0
106+
Animation87 = Instance.new("Animation")
107-
Part9.CFrame = CFrame.new(-69.4000015, 1.00000405, 79.9000015, 0, 0, -1, 0, 1, 0, 1, 0, 0)
107+
StringValue88 = Instance.new("StringValue")
108-
Part9.Orientation = Vector3.new(0, -90, 0)
108+
Animation89 = Instance.new("Animation")
109-
Part9.Position = Vector3.new(-69.4000015, 1.00000405, 79.9000015)
109+
NumberValue90 = Instance.new("NumberValue")
110-
Part9.Rotation = Vector3.new(0, -90, 0)
110+
Animation91 = Instance.new("Animation")
111-
Part9.Color = Color3.new(0.972549, 0.972549, 0.972549)
111+
NumberValue92 = Instance.new("NumberValue")
112-
Part9.Size = Vector3.new(1, 2, 1)
112+
Animation93 = Instance.new("Animation")
113-
Part9.Anchored = true
113+
NumberValue94 = Instance.new("NumberValue")
114-
Part9.BottomSurface = Enum.SurfaceType.Smooth
114+
StringValue95 = Instance.new("StringValue")
115-
Part9.BrickColor = BrickColor.new("Institutional white")
115+
Animation96 = Instance.new("Animation")
116-
Part9.TopSurface = Enum.SurfaceType.Smooth
116+
NumberValue97 = Instance.new("NumberValue")
117-
Part9.brickColor = BrickColor.new("Institutional white")
117+
Animation98 = Instance.new("Animation")
118-
Part9.FormFactor = Enum.FormFactor.Symmetric
118+
NumberValue99 = Instance.new("NumberValue")
119-
Part9.formFactor = Enum.FormFactor.Symmetric
119+
Animation100 = Instance.new("Animation")
120-
Humanoid10.Parent = Model0
120+
NumberValue101 = Instance.new("NumberValue")
121-
Humanoid10.LeftLeg = Part8
121+
StringValue102 = Instance.new("StringValue")
122-
Humanoid10.NameOcclusion = Enum.NameOcclusion.NoOcclusion
122+
Animation103 = Instance.new("Animation")
123-
Humanoid10.RightLeg = Part9
123+
NumberValue104 = Instance.new("NumberValue")
124-
Humanoid10.Torso = Part7
124+
Animation105 = Instance.new("Animation")
125-
Script11.Name = "Animation"
125+
NumberValue106 = Instance.new("NumberValue")
126-
Script11.Parent = Model0
126+
Animation107 = Instance.new("Animation")
127
NumberValue108 = Instance.new("NumberValue")
128
StringValue109 = Instance.new("StringValue")
129-
wait(0.1)
129+
Animation110 = Instance.new("Animation")
130-
			script.Parent.RA.Transparency = 0
130+
StringValue111 = Instance.new("StringValue")
131-
			script.Parent.RA1.Transparency = 1
131+
Animation112 = Instance.new("Animation")
132-
wait(0.5)
132+
NumberValue113 = Instance.new("NumberValue")
133-
			script.Parent.RA1.Transparency = 0
133+
Animation114 = Instance.new("Animation")
134-
			script.Parent.RA.Transparency = 1
134+
NumberValue115 = Instance.new("NumberValue")
135
StringValue116 = Instance.new("StringValue")
136
Animation117 = Instance.new("Animation")
137
StringValue118 = Instance.new("StringValue")
138-
Part12.Name = "Vuvuzela"
138+
Animation119 = Instance.new("Animation")
139-
Part12.Parent = Model0
139+
StringValue120 = Instance.new("StringValue")
140-
Part12.CFrame = CFrame.new(-67.2400055, 3.36996007, 79.4000015, 8.94069672e-08, -0.866033018, 0.499980032, 1.19209346e-07, 0.499979794, 0.866032183, -0.999992847, -5.96046448e-08, 1.49011612e-07)
140+
Animation121 = Instance.new("Animation")
141-
Part12.Orientation = Vector3.new(-60, 90, 0)
141+
StringValue122 = Instance.new("StringValue")
142-
Part12.Position = Vector3.new(-67.2400055, 3.36996007, 79.4000015)
142+
Animation123 = Instance.new("Animation")
143-
Part12.Rotation = Vector3.new(-90, 30, 90)
143+
StringValue124 = Instance.new("StringValue")
144-
Part12.Color = Color3.new(0.972549, 0.972549, 0.972549)
144+
Animation125 = Instance.new("Animation")
145-
Part12.Size = Vector3.new(2, 2.4000001, 1)
145+
StringValue126 = Instance.new("StringValue")
146-
Part12.Anchored = true
146+
Animation127 = Instance.new("Animation")
147-
Part12.BottomSurface = Enum.SurfaceType.Smooth
147+
StringValue128 = Instance.new("StringValue")
148-
Part12.BrickColor = BrickColor.new("Institutional white")
148+
Animation129 = Instance.new("Animation")
149-
Part12.TopSurface = Enum.SurfaceType.Smooth
149+
StringValue130 = Instance.new("StringValue")
150-
Part12.brickColor = BrickColor.new("Institutional white")
150+
Animation131 = Instance.new("Animation")
151-
SpecialMesh13.Parent = Part12
151+
StringValue132 = Instance.new("StringValue")
152-
SpecialMesh13.MeshId = "http://www.roblox.com/asset/?id=29086478"
152+
Animation133 = Instance.new("Animation")
153-
SpecialMesh13.TextureId = "http://www.roblox.com/asset/?id=36527069"
153+
StringValue134 = Instance.new("StringValue")
154-
SpecialMesh13.MeshType = Enum.MeshType.FileMesh
154+
Animation135 = Instance.new("Animation")
155-
Part14.Name = "Left Arm"
155+
StringValue136 = Instance.new("StringValue")
156-
Part14.Parent = Model0
156+
Animation137 = Instance.new("Animation")
157-
Part14.CFrame = CFrame.new(-68.9000015, 3.4999609, 78.6999969, -0.707084835, -0.612387955, -0.35357064, 0, 0.500008881, -0.866020322, 0.707128823, -0.612349808, -0.353548646)
157+
StringValue138 = Instance.new("StringValue")
158-
Part14.Orientation = Vector3.new(60, -135, 0)
158+
Animation139 = Instance.new("Animation")
159-
Part14.Position = Vector3.new(-68.9000015, 3.4999609, 78.6999969)
159+
Script140 = Instance.new("Script")
160-
Part14.Rotation = Vector3.new(112.209999, -20.7099991, 139.110001)
160+
Script141 = Instance.new("Script")
161-
Part14.Color = Color3.new(0.972549, 0.972549, 0.972549)
161+
Script142 = Instance.new("Script")
162-
Part14.Size = Vector3.new(1, 2, 1)
162+
LocalScript143 = Instance.new("LocalScript")
163-
Part14.Anchored = true
163+
Script144 = Instance.new("Script")
164-
Part14.BottomSurface = Enum.SurfaceType.Smooth
164+
ObjectValue145 = Instance.new("ObjectValue")
165-
Part14.BrickColor = BrickColor.new("Institutional white")
165+
MeshPart146 = Instance.new("MeshPart")
166-
Part14.TopSurface = Enum.SurfaceType.Smooth
166+
Vector3Value147 = Instance.new("Vector3Value")
167-
Part14.brickColor = BrickColor.new("Institutional white")
167+
Script148 = Instance.new("Script")
168-
Part14.FormFactor = Enum.FormFactor.Symmetric
168+
Script149 = Instance.new("Script")
169-
Part14.formFactor = Enum.FormFactor.Symmetric
169+
Script150 = Instance.new("Script")
170-
Part15.Name = "RA1"
170+
Motor6D151 = Instance.new("Motor6D")
171-
Part15.Parent = Model0
171+
Model0.Name = " "
172-
Part15.CFrame = CFrame.new(-68.2999954, 3.39994907, 80.1999969, 0.49998197, -0.86603719, 0, 0, -1.49011612e-08, -1.00000024, 0.866036296, 0.499982387, 7.45058237e-09)
172+
173-
Part15.Orientation = Vector3.new(90, -60, 0)
173+
Script1.Name = "MusicScript"
174-
Part15.Position = Vector3.new(-68.2999954, 3.39994907, 80.1999969)
174+
Script1.Parent = Model0
175-
Part15.Rotation = Vector3.new(90, 0, 60)
175+
table.insert(cors,sandbox(Script1,function()
176-
Part15.Color = Color3.new(0.972549, 0.972549, 0.972549)
176+
--Made by Stickmasterluke
177-
Part15.Transparency = 1
177+
gw=game.Workspace
178-
Part15.Size = Vector3.new(1, 2, 1)
178+
179-
Part15.Anchored = true
179+
function message(text,time)
180-
Part15.BottomSurface = Enum.SurfaceType.Smooth
180+
	local oldmsg=gw:FindFirstChild("Hint")
181-
Part15.BrickColor = BrickColor.new("Institutional white")
181+
	if oldmsg then
182-
Part15.TopSurface = Enum.SurfaceType.Smooth
182+
		oldmsg.Parent=nil
183-
Part15.brickColor = BrickColor.new("Institutional white")
183+
184-
Part15.FormFactor = Enum.FormFactor.Symmetric
184+
	local spacenumber=time*0
185-
Part15.formFactor = Enum.FormFactor.Symmetric
185+
	local msg=Instance.new("Hint")
186-
Part16.Name = "RA"
186+
	msg.Parent=gw
187-
Part16.Parent = Model0
187+
	--[[for i=1, spacenumber do
188-
Part16.CFrame = CFrame.new(-68.2999954, 3.39994907, 80.1999969, 0.49998197, -0.836529493, -0.224137977, 0, 0.25880897, -0.965928793, 0.866036296, 0.482946992, 0.129399821)
188+
		wait(1/25)
189-
Part16.Orientation = Vector3.new(75, -60, 0)
189+
		local maketext=""
190-
Part16.Position = Vector3.new(-68.2999954, 3.39994907, 80.1999969)
190+
		for i2=1, i do
191-
Part16.Rotation = Vector3.new(82.3699951, -12.9499998, 59.1299973)
191+
			maketext=maketext.." "
192-
Part16.Color = Color3.new(0.972549, 0.972549, 0.972549)
192+
		end
193-
Part16.Size = Vector3.new(1, 2, 1)
193+
		maketext=maketext..text
194-
Part16.Anchored = true
194+
		for i2=1, spacenumber-i do
195-
Part16.BottomSurface = Enum.SurfaceType.Smooth
195+
			maketext=maketext.." "
196-
Part16.BrickColor = BrickColor.new("Institutional white")
196+
		end
197-
Part16.TopSurface = Enum.SurfaceType.Smooth
197+
		msg.Text=maketext
198-
Part16.brickColor = BrickColor.new("Institutional white")
198+
	end]]
199-
Part16.FormFactor = Enum.FormFactor.Symmetric
199+
	msg.Text=text
200-
Part16.formFactor = Enum.FormFactor.Symmetric
200+
	wait(0)
201-
Shirt17.Name = "Shirt"
201+
	msg.Parent=nil
202-
Shirt17.Parent = Model0
202+
203-
Shirt17.ShirtTemplate = "http://www.roblox.com/asset/?id=302011210"
203+
204-
Pants18.Name = "Pants"
204+
last=""
205-
Pants18.Parent = Model0
205+
lastlast=""
206-
Pants18.PantsTemplate = "http://www.roblox.com/asset/?id=305718140"
206+
207-
Part19.Name = "Flame"
207+
	wait(0)
208-
Part19.Parent = Model0
208+
	local tracks=script:GetChildren()
209-
Part19.CFrame = CFrame.new(-68.8000031, 4.59995794, 79.1999969, 1, 0, 0, 0, 1, 0, 0, 0, 1)
209+
	local rn=math.random(1,#tracks)
210-
Part19.Position = Vector3.new(-68.8000031, 4.59995794, 79.1999969)
210+
	local track=tracks[rn]
211-
Part19.Color = Color3.new(0, 1, 1)
211+
	if track~=nil then
212-
Part19.Transparency = 1
212+
		if track.className=="Sound" and track.Name~=last and track.Name~=lastlast then
213-
Part19.Size = Vector3.new(1.4000001, 1.4000001, 1.4000001)
213+
			lastlast=last
214-
Part19.Anchored = true
214+
			last=track.Name
215-
Part19.BottomSurface = Enum.SurfaceType.Smooth
215+
			message(track.Name,50)
216-
Part19.BrickColor = BrickColor.new("Toothpaste")
216+
			track:play()
217-
Part19.TopSurface = Enum.SurfaceType.Smooth
217+
			wait(10000000000000000000000000)
218-
Part19.brickColor = BrickColor.new("Toothpaste")
218+
			track:pause()
219-
Part19.Shape = Enum.PartType.Ball
219+
		end
220-
Fire20.Parent = Part19
220+
221-
Fire20.Color = Color3.new(0, 1, 1)
221+
222-
Fire20.Size = 2
222+
	
223-
Fire20.Heat = 25
223+
224-
Fire20.size = 2
224+
Sound2.Name = "Shrek Anthem"
225
Sound2.Parent = Script1
226
Sound2.Looped = true
227
Sound2.SoundId = "rbxassetid://869166432"
228
Sound2.Volume = 10
229
MeshPart3.Name = "LeftHand"
230
MeshPart3.Parent = Model0
231
MeshPart3.CFrame = CFrame.new(-44.8896103, 14.6752701, 32.3903465, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
232
MeshPart3.Orientation = Vector3.new(0, -89.9599991, 0)
233
MeshPart3.Position = Vector3.new(-44.8896103, 14.6752701, 32.3903465)
234
MeshPart3.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
235
MeshPart3.Color = Color3.new(0.960784, 0.803922, 0.188235)
236
MeshPart3.Size = Vector3.new(6.76771307, 2.27050734, 6.77447462)
237
MeshPart3.BrickColor = BrickColor.new("Bright yellow")
238
MeshPart3.CanCollide = false
239
MeshPart3.brickColor = BrickColor.new("Bright yellow")
240
Vector3Value4.Name = "OriginalSize"
241
Vector3Value4.Parent = MeshPart3
242
Vector3Value4.Value = Vector3.new(0.999299049, 0.335255831, 1.00029743)
243
Script5.Name = "ShieldScript"
244
Script5.Parent = MeshPart3
245
table.insert(cors,sandbox(Script5,function()
246
function ot(hit)
247
	ch = hit:GetChildren()
248
	for i = 1, #ch do
249
		if ch[i].className == "BodyVelocity" then
250
			ch[i].velocity = ch[i].velocity*-1
251
		end
252
	end
253
	if hit.Parent ~= nil then
254
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
255
			if hit.Parent ~= script.Parent.Parent then
256
				if hit.Parent:FindFirstChild("Torso") ~= nil then
257
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
258
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
259
				end
260
				hit.Parent.Humanoid.PlatformStand = true
261
			end
262
		else
263
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
264
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
265
					hit:breakJoints()
266
					if hit.Anchored == false then
267
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
268
					end
269
				end
270
			else
271
				hit:breakJoints()
272
				if hit.Anchored == false then
273
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
274
				end
275
			end
276
		end
277
	end
278
	if hit.Parent ~= nil then
279
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
280
			if hit.Parent ~= script.Parent.Parent then
281
				wait(0.5)
282
				hit.Parent.Humanoid.PlatformStand = false
283
			end
284
		end
285
	end
286
end
287
function remove(child)
288
	child:Remove()
289
end
290
script.Parent.Touched:connect(ot)
291
script.Parent.ChildAdded:connect(remove)
292
end))
293
Script6.Name = "Hurting"
294
Script6.Parent = MeshPart3
295
table.insert(cors,sandbox(Script6,function()
296
function onTouched(hit)
297
	local humanoid = hit.Parent:findFirstChild("Humanoid")
298
	if (humanoid ~= nil) then
299
		humanoid.Health = humanoid.Health - 25
300
	end
301
end
302
303
script.Parent.Touched:connect(onTouched)
304
end))
305
Script7.Name = "qPerfectionWeld"
306
Script7.Parent = MeshPart3
307
table.insert(cors,sandbox(Script7,function()
308
-- Created by Quenty (@Quenty, follow me on twitter).
309
-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
310
-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
311
312
--[[ INSTRUCTIONS
313
- Place in the model
314
- Make sure model is anchored
315
- That's it. It will weld the model and all children. 
316
317
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
318
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
319
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
320
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
321
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
322
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
323
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
324
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
325
326
This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes. 
327
]]
328
329
--[[ DOCUMENTATION
330
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
331
- Will work in PBS servers
332
- Will work as long as it starts out with the part anchored
333
- Stores the relative CFrame as a CFrame value
334
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
335
- Utilizes a recursive algorith to find all parts in the model
336
- Will reweld on script reparent if the script is initially parented to a tool.
337
- Welds as fast as possible
338
]]
339
340
-- qPerfectionWeld.lua
341
-- Created 10/6/2014
342
-- Author: Quenty
343
-- Version 1.0.3
344
345
-- Updated 10/14/2014 - Updated to 1.0.1
346
--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
347
348
-- Updated 10/14/2014 - Updated to 1.0.2
349
--- Fixed bug fix. 
350
351
-- Updated 10/14/2014 - Updated to 1.0.3
352
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
353
354
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
355
356
357
local function CallOnChildren(Instance, FunctionToCall)
358
	-- Calls a function on each of the children of a certain object, using recursion.  
359
360
	FunctionToCall(Instance)
361
362
	for _, Child in next, Instance:GetChildren() do
363
		CallOnChildren(Child, FunctionToCall)
364
	end
365
end
366
367
local function GetNearestParent(Instance, ClassName)
368
	-- Returns the nearest parent of a certain class, or returns nil
369
370
	local Ancestor = Instance
371
	repeat
372
		Ancestor = Ancestor.Parent
373
		if Ancestor == nil then
374
			return nil
375
		end
376
	until Ancestor:IsA(ClassName)
377
378
	return Ancestor
379
end
380
381
local function GetBricks(StartInstance)
382
	local List = {}
383
384
	-- if StartInstance:IsA("BasePart") then
385
	-- 	List[#List+1] = StartInstance
386
	-- end
387
388
	CallOnChildren(StartInstance, function(Item)
389
		if Item:IsA("BasePart") then
390
			List[#List+1] = Item;
391
		end
392
	end)
393
394
	return List
395
end
396
397
local function Modify(Instance, Values)
398
	-- Modifies an Instance by using a table.  
399
400
	assert(type(Values) == "table", "Values is not a table");
401
402
	for Index, Value in next, Values do
403
		if type(Index) == "number" then
404
			Value.Parent = Instance
405
		else
406
			Instance[Index] = Value
407
		end
408
	end
409
	return Instance
410
end
411
412
local function Make(ClassType, Properties)
413
	-- Using a syntax hack to create a nice way to Make new items.  
414
415
	return Modify(Instance.new(ClassType), Properties)
416
end
417
418
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
419
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
420
421
local function HasWheelJoint(Part)
422
	for _, SurfaceName in pairs(Surfaces) do
423
		for _, HingSurfaceName in pairs(HingSurfaces) do
424
			if Part[SurfaceName].Name == HingSurfaceName then
425
				return true
426
			end
427
		end
428
	end
429
	
430
	return false
431
end
432
433
local function ShouldBreakJoints(Part)
434
	--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
435
	--  definitely some edge cases. 
436
437
	if NEVER_BREAK_JOINTS then
438
		return false
439
	end
440
	
441
	if HasWheelJoint(Part) then
442
		return false
443
	end
444
	
445
	local Connected = Part:GetConnectedParts()
446
	
447
	if #Connected == 1 then
448
		return false
449
	end
450
	
451
	for _, Item in pairs(Connected) do
452
		if HasWheelJoint(Item) then
453
			return false
454
		elseif not Item:IsDescendantOf(script.Parent) then
455
			return false
456
		end
457
	end
458
	
459
	return true
460
end
461
462
local function WeldTogether(Part0, Part1, JointType, WeldParent)
463
	--- Weld's 2 parts together
464
	-- @param Part0 The first part
465
	-- @param Part1 The second part (Dependent part most of the time).
466
	-- @param [JointType] The type of joint. Defaults to weld.
467
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
468
	-- @return The weld created.
469
470
	JointType = JointType or "Weld"
471
	local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
472
	
473
	local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
474
	Modify(NewWeld, {
475
		Name = "qCFrameWeldThingy";
476
		Part0  = Part0;
477
		Part1  = Part1;
478
		C0     = CFrame.new();--Part0.CFrame:inverse();
479
		C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
480
		Parent = Part1;
481
	})
482
483
	if not RelativeValue then
484
		RelativeValue = Make("CFrameValue", {
485
			Parent     = Part1;
486
			Name       = "qRelativeCFrameWeldValue";
487
			Archivable = true;
488
			Value      = NewWeld.C1;
489
		})
490
	end
491
492
	return NewWeld
493
end
494
495
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
496
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
497
	-- @param MainPart The part to weld the model to (can be in the model).
498
	-- @param [JointType] The type of joint. Defaults to weld. 
499
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
500
	
501
	for _, Part in pairs(Parts) do
502
		if ShouldBreakJoints(Part) then
503
			Part:BreakJoints()
504
		end
505
	end
506
	
507
	for _, Part in pairs(Parts) do
508
		if Part ~= MainPart then
509
			WeldTogether(MainPart, Part, JointType, MainPart)
510
		end
511
	end
512
513
	if not DoNotUnanchor then
514
		for _, Part in pairs(Parts) do
515
			Part.Anchored = false
516
		end
517
		MainPart.Anchored = false
518
	end
519
end
520
521
local function PerfectionWeld()	
522
	local Tool = GetNearestParent(script, "Tool")
523
524
	local Parts = GetBricks(script.Parent)
525
	local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
526
527
	if PrimaryPart then
528
		WeldParts(Parts, PrimaryPart, "Weld", false)
529
	else
530
		warn("qWeld - Unable to weld part")
531
	end
532
	
533
	return Tool
534
end
535
536
local Tool = PerfectionWeld()
537
538
539
if Tool and script.ClassName == "Script" then
540
	--- Don't bother with local scripts
541
542
	script.Parent.AncestryChanged:connect(function()
543
		PerfectionWeld()
544
	end)
545
end
546
547
-- Created by Quenty (@Quenty, follow me on twitter).
548
549
end))
550
Motor6D8.Name = "LeftWrist"
551
Motor6D8.Parent = MeshPart3
552
Motor6D8.C0 = CFrame.new(-0.0112809651, -4.6205492, -0.0670197308, 1, 0, 0, 0, 1, 0, 0, 0, 1)
553
Motor6D8.C1 = CFrame.new(-0.0026157822, 0.39213115, -0.104560249, 1, 0, 0, 0, 1, 0, 0, 0, 1)
554
Motor6D8.Part0 = MeshPart9
555
Motor6D8.Part1 = MeshPart3
556
Motor6D8.part1 = MeshPart3
557
MeshPart9.Name = "LeftLowerArm"
558
MeshPart9.Parent = Model0
559
MeshPart9.CFrame = CFrame.new(-44.8519096, 19.6879501, 32.3990784, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
560
MeshPart9.Orientation = Vector3.new(0, -89.9599991, 0)
561
MeshPart9.Position = Vector3.new(-44.8519096, 19.6879501, 32.3990784)
562
MeshPart9.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
563
MeshPart9.Color = Color3.new(0.960784, 0.803922, 0.188235)
564
MeshPart9.Size = Vector3.new(6.77433443, 8.5717144, 6.77415848)
565
MeshPart9.BrickColor = BrickColor.new("Bright yellow")
566
MeshPart9.CanCollide = false
567
MeshPart9.brickColor = BrickColor.new("Bright yellow")
568
Vector3Value10.Name = "OriginalSize"
569
Vector3Value10.Parent = MeshPart9
570
Vector3Value10.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
571
Script11.Name = "Hurting"
572
Script11.Parent = MeshPart9
573
table.insert(cors,sandbox(Script11,function()
574
function onTouched(hit)
575
	local humanoid = hit.Parent:findFirstChild("Humanoid")
576
	if (humanoid ~= nil) then
577
		humanoid.Health = humanoid.Health - 25
578
	end
579
end
580
581
script.Parent.Touched:connect(onTouched)
582
end))
583
Script12.Name = "ShieldScript"
584
Script12.Parent = MeshPart9
585
table.insert(cors,sandbox(Script12,function()
586
function ot(hit)
587
	ch = hit:GetChildren()
588
	for i = 1, #ch do
589
		if ch[i].className == "BodyVelocity" then
590
			ch[i].velocity = ch[i].velocity*-1
591
		end
592
	end
593
	if hit.Parent ~= nil then
594
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
595
			if hit.Parent ~= script.Parent.Parent then
596
				if hit.Parent:FindFirstChild("Torso") ~= nil then
597
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
598
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
599
				end
600
				hit.Parent.Humanoid.PlatformStand = true
601
			end
602
		else
603
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
604
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
605
					hit:breakJoints()
606
					if hit.Anchored == false then
607
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
608
					end
609
				end
610
			else
611
				hit:breakJoints()
612
				if hit.Anchored == false then
613
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
614
				end
615
			end
616
		end
617
	end
618
	if hit.Parent ~= nil then
619
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
620
			if hit.Parent ~= script.Parent.Parent then
621
				wait(0.5)
622
				hit.Parent.Humanoid.PlatformStand = false
623
			end
624
		end
625
	end
626
end
627
function remove(child)
628
	child:Remove()
629
end
630
script.Parent.Touched:connect(ot)
631
script.Parent.ChildAdded:connect(remove)
632
end))
633
Motor6D13.Name = "LeftElbow"
634
Motor6D13.Parent = MeshPart9
635
Motor6D13.C0 = CFrame.new(-0.0112769287, -1.78210199, -0.0639314502, 1, 0, 0, 0, 1, 0, 0, 0, 1)
636
Motor6D13.C1 = CFrame.new(-0.0112809651, 0.832677782, -0.0670197308, 1, 0, 0, 0, 1, 0, 0, 0, 1)
637
Motor6D13.Part0 = MeshPart17
638
Motor6D13.Part1 = MeshPart9
639
Motor6D13.part1 = MeshPart9
640
MeshPart14.Name = "LeftLowerLeg"
641
MeshPart14.Parent = Model0
642
MeshPart14.CFrame = CFrame.new(-44.8823509, 6.16508913, 39.1501884, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
643
MeshPart14.Orientation = Vector3.new(0, -89.9599991, 0)
644
MeshPart14.Position = Vector3.new(-44.8823509, 6.16508913, 39.1501884)
645
MeshPart14.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
646
MeshPart14.Color = Color3.new(0.294118, 0.592157, 0.294118)
647
MeshPart14.Size = Vector3.new(6.77432919, 10.088563, 6.77468634)
648
MeshPart14.BrickColor = BrickColor.new("Bright green")
649
MeshPart14.CanCollide = false
650
MeshPart14.brickColor = BrickColor.new("Bright green")
651
Vector3Value15.Name = "OriginalSize"
652
Vector3Value15.Parent = MeshPart14
653
Vector3Value15.Value = Vector3.new(1.00027585, 1.48964536, 1.00032866)
654
Motor6D16.Name = "LeftKnee"
655
Motor6D16.Parent = MeshPart14
656
Motor6D16.C0 = CFrame.new(-0.0259127952, -1.79122257, 0.00397367822, 1, 0, 0, 0, 1, 0, 0, 0, 1)
657
Motor6D16.C1 = CFrame.new(-0.0259127952, 1.9631238, 0.00206926349, 1, 0, 0, 0, 1, 0, 0, 0, 1)
658
Motor6D16.Part0 = MeshPart20
659
Motor6D16.Part1 = MeshPart14
660
Motor6D16.part1 = MeshPart14
661
MeshPart17.Name = "LeftUpperArm"
662
MeshPart17.Parent = Model0
663
MeshPart17.CFrame = CFrame.new(-44.8487396, 22.3027306, 32.3991203, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
664
MeshPart17.Orientation = Vector3.new(0, -89.9599991, 0)
665
MeshPart17.Position = Vector3.new(-44.8487396, 22.3027306, 32.3991203)
666
MeshPart17.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
667
MeshPart17.Color = Color3.new(1, 1, 0)
668
MeshPart17.Size = Vector3.new(6.77433252, 9.45123863, 6.77415848)
669
MeshPart17.BrickColor = BrickColor.new("New Yeller")
670
MeshPart17.CanCollide = false
671
MeshPart17.brickColor = BrickColor.new("New Yeller")
672
Vector3Value18.Name = "OriginalSize"
673
Vector3Value18.Parent = MeshPart17
674
Vector3Value18.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
675
Motor6D19.Name = "LeftShoulder"
676
Motor6D19.Parent = MeshPart17
677
Motor6D19.C0 = CFrame.new(-8.46254921, 3.768255, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
678
Motor6D19.C1 = CFrame.new(1.67933309, 3.09320617, -0.0639314502, 1, 0, 0, 0, 1, 0, 0, 0, 1)
679
Motor6D19.Part0 = MeshPart57
680
Motor6D19.Part1 = MeshPart17
681
Motor6D19.part1 = MeshPart17
682
MeshPart20.Name = "LeftUpperLeg"
683
MeshPart20.Parent = Model0
684
MeshPart20.CFrame = CFrame.new(-44.8803291, 9.9194355, 39.1502571, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
685
MeshPart20.Orientation = Vector3.new(0, -89.9599991, 0)
686
MeshPart20.Position = Vector3.new(-44.8803291, 9.9194355, 39.1502571)
687
MeshPart20.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
688
MeshPart20.Color = Color3.new(0, 1, 0)
689
MeshPart20.Size = Vector3.new(6.7743268, 10.4042921, 6.77875233)
690
MeshPart20.BrickColor = BrickColor.new("Lime green")
691
MeshPart20.CanCollide = false
692
MeshPart20.brickColor = BrickColor.new("Lime green")
693
Vector3Value21.Name = "OriginalSize"
694
Vector3Value21.Parent = MeshPart20
695
Vector3Value21.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
696
Motor6D22.Name = "LeftHip"
697
Motor6D22.Parent = MeshPart20
698
Motor6D22.C0 = CFrame.new(-3.41684103, -1.64612925, 0.00831584446, 1, 0, 0, 0, 1, 0, 0, 0, 1)
699
Motor6D22.C1 = CFrame.new(-0.0259127952, 3.28541422, 0.00465092249, 1, 0, 0, 0, 1, 0, 0, 0, 1)
700
Motor6D22.Part0 = MeshPart23
701
Motor6D22.Part1 = MeshPart20
702
Motor6D22.part1 = MeshPart20
703
MeshPart23.Name = "LowerTorso"
704
MeshPart23.Parent = Model0
705
MeshPart23.CFrame = CFrame.new(-44.873909, 14.850914, 42.541275, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
706
MeshPart23.Orientation = Vector3.new(0, -89.9599991, 0)
707
MeshPart23.Position = Vector3.new(-44.873909, 14.850914, 42.541275)
708
MeshPart23.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
709
MeshPart23.Color = Color3.new(0.0509804, 0.411765, 0.67451)
710
MeshPart23.Size = Vector3.new(13.546114, 2.70923901, 6.77390051)
711
MeshPart23.BrickColor = BrickColor.new("Bright blue")
712
MeshPart23.brickColor = BrickColor.new("Bright blue")
713
Vector3Value24.Name = "OriginalSize"
714
Vector3Value24.Parent = MeshPart23
715
Vector3Value24.Value = Vector3.new(2.00017595, 0.400037616, 1.00021255)
716
Script25.Name = "Hurting"
717
Script25.Parent = MeshPart23
718
table.insert(cors,sandbox(Script25,function()
719
function onTouched(hit)
720
	local humanoid = hit.Parent:findFirstChild("Humanoid")
721
	if (humanoid ~= nil) then
722
		humanoid.Health = humanoid.Health - 25
723
	end
724
end
725
726
script.Parent.Touched:connect(onTouched)
727
end))
728
Script26.Name = "ShieldScript"
729
Script26.Parent = MeshPart23
730
table.insert(cors,sandbox(Script26,function()
731
function ot(hit)
732
	ch = hit:GetChildren()
733
	for i = 1, #ch do
734
		if ch[i].className == "BodyVelocity" then
735
			ch[i].velocity = ch[i].velocity*-1
736
		end
737
	end
738
	if hit.Parent ~= nil then
739
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
740
			if hit.Parent ~= script.Parent.Parent then
741
				if hit.Parent:FindFirstChild("Torso") ~= nil then
742
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
743
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
744
				end
745
				hit.Parent.Humanoid.PlatformStand = true
746
			end
747
		else
748
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
749
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
750
					hit:breakJoints()
751
					if hit.Anchored == false then
752
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
753
					end
754
				end
755
			else
756
				hit:breakJoints()
757
				if hit.Anchored == false then
758
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
759
				end
760
			end
761
		end
762
	end
763
	if hit.Parent ~= nil then
764
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
765
			if hit.Parent ~= script.Parent.Parent then
766
				wait(0.5)
767
				hit.Parent.Humanoid.PlatformStand = false
768
			end
769
		end
770
	end
771
end
772
function remove(child)
773
	child:Remove()
774
end
775
script.Parent.Touched:connect(ot)
776
script.Parent.ChildAdded:connect(remove)
777
end))
778
Motor6D27.Name = "Root"
779
Motor6D27.Parent = MeshPart23
780
Motor6D27.C1 = CFrame.new(0.00189745135, 0.900993049, -0.0966572911, 1, 0, 0, 0, 1, 0, 0, 0, 1)
781
Motor6D27.Part0 = Part64
782
Motor6D27.Part1 = MeshPart23
783
Motor6D27.part1 = MeshPart23
784
Script28.Name = "Respawn"
785
Script28.Parent = Model0
786
table.insert(cors,sandbox(Script28,function()
787
name="NPC"
788
789
robo=script.Parent:clone()
790
791
while true do
792
	wait(15)
793
	if script.Parent.NPC.Health<1 then
794
		robot=robo:clone()
795
		robot.Parent=script.Parent.Parent
796
		robot:makeJoints()
797
		script.Parent:remove()
798
	end
799
end
800
		
801
802
803
804
end))
805
MeshPart29.Name = "RightFoot"
806
MeshPart29.Parent = Model0
807
MeshPart29.CFrame = CFrame.new(-44.8781891, 1.13590193, 45.900589, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
808
MeshPart29.Orientation = Vector3.new(0, -89.9599991, 0)
809
MeshPart29.Position = Vector3.new(-44.8781891, 1.13590193, 45.900589)
810
MeshPart29.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
811
MeshPart29.Color = Color3.new(0.294118, 0.592157, 0.294118)
812
MeshPart29.Size = Vector3.new(6.77673674, 2.27153325, 6.77383852)
813
MeshPart29.BrickColor = BrickColor.new("Bright green")
814
MeshPart29.CanCollide = false
815
MeshPart29.brickColor = BrickColor.new("Bright green")
816
Vector3Value30.Name = "OriginalSize"
817
Vector3Value30.Parent = MeshPart29
818
Vector3Value30.Value = Vector3.new(1.00063133, 0.335407376, 1.00020337)
819
Script31.Name = "ShieldScript"
820
Script31.Parent = MeshPart29
821
table.insert(cors,sandbox(Script31,function()
822
function ot(hit)
823
	ch = hit:GetChildren()
824
	for i = 1, #ch do
825
		if ch[i].className == "BodyVelocity" then
826
			ch[i].velocity = ch[i].velocity*-1
827
		end
828
	end
829
	if hit.Parent ~= nil then
830
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
831
			if hit.Parent ~= script.Parent.Parent then
832
				if hit.Parent:FindFirstChild("Torso") ~= nil then
833
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
834
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
835
				end
836
				hit.Parent.Humanoid.PlatformStand = true
837
			end
838
		else
839
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
840
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
841
					hit:breakJoints()
842
					if hit.Anchored == false then
843
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
844
					end
845
				end
846
			else
847
				hit:breakJoints()
848
				if hit.Anchored == false then
849
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
850
				end
851
			end
852
		end
853
	end
854
	if hit.Parent ~= nil then
855
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
856
			if hit.Parent ~= script.Parent.Parent then
857
				wait(0.5)
858
				hit.Parent.Humanoid.PlatformStand = false
859
			end
860
		end
861
	end
862
end
863
function remove(child)
864
	child:Remove()
865
end
866
script.Parent.Touched:connect(ot)
867
script.Parent.ChildAdded:connect(remove)
868
end))
869
Script32.Name = "Hurting"
870
Script32.Parent = MeshPart29
871
table.insert(cors,sandbox(Script32,function()
872
function onTouched(hit)
873
	local humanoid = hit.Parent:findFirstChild("Humanoid")
874
	if (humanoid ~= nil) then
875
		humanoid.Health = humanoid.Health - 25
876
	end
877
end
878
879
script.Parent.Touched:connect(onTouched)
880
end))
881
Script33.Name = "qPerfectionWeld"
882
Script33.Parent = MeshPart29
883
table.insert(cors,sandbox(Script33,function()
884
-- Created by Quenty (@Quenty, follow me on twitter).
885
-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
886
-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
887
888
--[[ INSTRUCTIONS
889
- Place in the model
890
- Make sure model is anchored
891
- That's it. It will weld the model and all children. 
892
893
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
894
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
895
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
896
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
897
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
898
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
899
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
900
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
901
902
This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes. 
903
]]
904
905
--[[ DOCUMENTATION
906
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
907
- Will work in PBS servers
908
- Will work as long as it starts out with the part anchored
909
- Stores the relative CFrame as a CFrame value
910
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
911
- Utilizes a recursive algorith to find all parts in the model
912
- Will reweld on script reparent if the script is initially parented to a tool.
913
- Welds as fast as possible
914
]]
915
916
-- qPerfectionWeld.lua
917
-- Created 10/6/2014
918
-- Author: Quenty
919
-- Version 1.0.3
920
921
-- Updated 10/14/2014 - Updated to 1.0.1
922
--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
923
924
-- Updated 10/14/2014 - Updated to 1.0.2
925
--- Fixed bug fix. 
926
927
-- Updated 10/14/2014 - Updated to 1.0.3
928
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
929
930
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
931
932
933
local function CallOnChildren(Instance, FunctionToCall)
934
	-- Calls a function on each of the children of a certain object, using recursion.  
935
936
	FunctionToCall(Instance)
937
938
	for _, Child in next, Instance:GetChildren() do
939
		CallOnChildren(Child, FunctionToCall)
940
	end
941
end
942
943
local function GetNearestParent(Instance, ClassName)
944
	-- Returns the nearest parent of a certain class, or returns nil
945
946
	local Ancestor = Instance
947
	repeat
948
		Ancestor = Ancestor.Parent
949
		if Ancestor == nil then
950
			return nil
951
		end
952
	until Ancestor:IsA(ClassName)
953
954
	return Ancestor
955
end
956
957
local function GetBricks(StartInstance)
958
	local List = {}
959
960
	-- if StartInstance:IsA("BasePart") then
961
	-- 	List[#List+1] = StartInstance
962
	-- end
963
964
	CallOnChildren(StartInstance, function(Item)
965
		if Item:IsA("BasePart") then
966
			List[#List+1] = Item;
967
		end
968
	end)
969
970
	return List
971
end
972
973
local function Modify(Instance, Values)
974
	-- Modifies an Instance by using a table.  
975
976
	assert(type(Values) == "table", "Values is not a table");
977
978
	for Index, Value in next, Values do
979
		if type(Index) == "number" then
980
			Value.Parent = Instance
981
		else
982
			Instance[Index] = Value
983
		end
984
	end
985
	return Instance
986
end
987
988
local function Make(ClassType, Properties)
989
	-- Using a syntax hack to create a nice way to Make new items.  
990
991
	return Modify(Instance.new(ClassType), Properties)
992
end
993
994
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
995
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
996
997
local function HasWheelJoint(Part)
998
	for _, SurfaceName in pairs(Surfaces) do
999
		for _, HingSurfaceName in pairs(HingSurfaces) do
1000
			if Part[SurfaceName].Name == HingSurfaceName then
1001
				return true
1002
			end
1003
		end
1004
	end
1005
	
1006
	return false
1007
end
1008
1009
local function ShouldBreakJoints(Part)
1010
	--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
1011
	--  definitely some edge cases. 
1012
1013
	if NEVER_BREAK_JOINTS then
1014
		return false
1015
	end
1016
	
1017
	if HasWheelJoint(Part) then
1018
		return false
1019
	end
1020
	
1021
	local Connected = Part:GetConnectedParts()
1022
	
1023
	if #Connected == 1 then
1024
		return false
1025
	end
1026
	
1027
	for _, Item in pairs(Connected) do
1028
		if HasWheelJoint(Item) then
1029
			return false
1030
		elseif not Item:IsDescendantOf(script.Parent) then
1031
			return false
1032
		end
1033
	end
1034
	
1035
	return true
1036
end
1037
1038
local function WeldTogether(Part0, Part1, JointType, WeldParent)
1039
	--- Weld's 2 parts together
1040
	-- @param Part0 The first part
1041
	-- @param Part1 The second part (Dependent part most of the time).
1042
	-- @param [JointType] The type of joint. Defaults to weld.
1043
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
1044
	-- @return The weld created.
1045
1046
	JointType = JointType or "Weld"
1047
	local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
1048
	
1049
	local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
1050
	Modify(NewWeld, {
1051
		Name = "qCFrameWeldThingy";
1052
		Part0  = Part0;
1053
		Part1  = Part1;
1054
		C0     = CFrame.new();--Part0.CFrame:inverse();
1055
		C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
1056
		Parent = Part1;
1057
	})
1058
1059
	if not RelativeValue then
1060
		RelativeValue = Make("CFrameValue", {
1061
			Parent     = Part1;
1062
			Name       = "qRelativeCFrameWeldValue";
1063
			Archivable = true;
1064
			Value      = NewWeld.C1;
1065
		})
1066
	end
1067
1068
	return NewWeld
1069
end
1070
1071
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
1072
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
1073
	-- @param MainPart The part to weld the model to (can be in the model).
1074
	-- @param [JointType] The type of joint. Defaults to weld. 
1075
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
1076
	
1077
	for _, Part in pairs(Parts) do
1078
		if ShouldBreakJoints(Part) then
1079
			Part:BreakJoints()
1080
		end
1081
	end
1082
	
1083
	for _, Part in pairs(Parts) do
1084
		if Part ~= MainPart then
1085
			WeldTogether(MainPart, Part, JointType, MainPart)
1086
		end
1087
	end
1088
1089
	if not DoNotUnanchor then
1090
		for _, Part in pairs(Parts) do
1091
			Part.Anchored = false
1092
		end
1093
		MainPart.Anchored = false
1094
	end
1095
end
1096
1097
local function PerfectionWeld()	
1098
	local Tool = GetNearestParent(script, "Tool")
1099
1100
	local Parts = GetBricks(script.Parent)
1101
	local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
1102
1103
	if PrimaryPart then
1104
		WeldParts(Parts, PrimaryPart, "Weld", false)
1105
	else
1106
		warn("qWeld - Unable to weld part")
1107
	end
1108
	
1109
	return Tool
1110
end
1111
1112
local Tool = PerfectionWeld()
1113
1114
1115
if Tool and script.ClassName == "Script" then
1116
	--- Don't bother with local scripts
1117
1118
	script.Parent.AncestryChanged:connect(function()
1119
		PerfectionWeld()
1120
	end)
1121
end
1122
1123
-- Created by Quenty (@Quenty, follow me on twitter).
1124
1125
end))
1126
Motor6D34.Name = "RightAnkle"
1127
Motor6D34.Parent = MeshPart29
1128
Motor6D34.C0 = CFrame.new(0.0259127952, -4.8134017, 0.00191943871, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1129
Motor6D34.C1 = CFrame.new(0.0610660091, 0.215656728, 0.0010534653, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1130
Motor6D34.Part0 = MeshPart46
1131
Motor6D34.Part1 = MeshPart29
1132
Motor6D34.part1 = MeshPart29
1133
MeshPart35.Name = "RightHand"
1134
MeshPart35.Parent = Model0
1135
MeshPart35.CFrame = CFrame.new(-44.8740196, 14.6748857, 52.6960068, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1136
MeshPart35.Orientation = Vector3.new(0, -89.9599991, 0)
1137
MeshPart35.Position = Vector3.new(-44.8740196, 14.6748857, 52.6960068)
1138
MeshPart35.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1139
MeshPart35.Color = Color3.new(0.960784, 0.803922, 0.188235)
1140
MeshPart35.Size = Vector3.new(6.76771307, 2.27050614, 6.77447462)
1141
MeshPart35.BrickColor = BrickColor.new("Bright yellow")
1142
MeshPart35.CanCollide = false
1143
MeshPart35.brickColor = BrickColor.new("Bright yellow")
1144
Vector3Value36.Name = "OriginalSize"
1145
Vector3Value36.Parent = MeshPart35
1146
Vector3Value36.Value = Vector3.new(0.999299049, 0.335255772, 1.00029743)
1147
Script37.Name = "ShieldScript"
1148
Script37.Parent = MeshPart35
1149
table.insert(cors,sandbox(Script37,function()
1150
function ot(hit)
1151
	ch = hit:GetChildren()
1152
	for i = 1, #ch do
1153
		if ch[i].className == "BodyVelocity" then
1154
			ch[i].velocity = ch[i].velocity*-1
1155
		end
1156
	end
1157
	if hit.Parent ~= nil then
1158
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1159
			if hit.Parent ~= script.Parent.Parent then
1160
				if hit.Parent:FindFirstChild("Torso") ~= nil then
1161
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1162
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1163
				end
1164
				hit.Parent.Humanoid.PlatformStand = true
1165
			end
1166
		else
1167
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
1168
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
1169
					hit:breakJoints()
1170
					if hit.Anchored == false then
1171
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1172
					end
1173
				end
1174
			else
1175
				hit:breakJoints()
1176
				if hit.Anchored == false then
1177
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1178
				end
1179
			end
1180
		end
1181
	end
1182
	if hit.Parent ~= nil then
1183
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1184
			if hit.Parent ~= script.Parent.Parent then
1185
				wait(0.5)
1186
				hit.Parent.Humanoid.PlatformStand = false
1187
			end
1188
		end
1189
	end
1190
end
1191
function remove(child)
1192
	child:Remove()
1193
end
1194
script.Parent.Touched:connect(ot)
1195
script.Parent.ChildAdded:connect(remove)
1196
end))
1197
Script38.Name = "Hurting"
1198
Script38.Parent = MeshPart35
1199
table.insert(cors,sandbox(Script38,function()
1200
function onTouched(hit)
1201
	local humanoid = hit.Parent:findFirstChild("Humanoid")
1202
	if (humanoid ~= nil) then
1203
		humanoid.Health = humanoid.Health - 25
1204
	end
1205
end
1206
1207
script.Parent.Touched:connect(onTouched)
1208
end))
1209
Script39.Name = "qPerfectionWeld"
1210
Script39.Parent = MeshPart35
1211
table.insert(cors,sandbox(Script39,function()
1212
-- Created by Quenty (@Quenty, follow me on twitter).
1213
-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
1214
-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
1215
1216
--[[ INSTRUCTIONS
1217
- Place in the model
1218
- Make sure model is anchored
1219
- That's it. It will weld the model and all children. 
1220
1221
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1222
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1223
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1224
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1225
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1226
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1227
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1228
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1229
1230
This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes. 
1231
]]
1232
1233
--[[ DOCUMENTATION
1234
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
1235
- Will work in PBS servers
1236
- Will work as long as it starts out with the part anchored
1237
- Stores the relative CFrame as a CFrame value
1238
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
1239
- Utilizes a recursive algorith to find all parts in the model
1240
- Will reweld on script reparent if the script is initially parented to a tool.
1241
- Welds as fast as possible
1242
]]
1243
1244
-- qPerfectionWeld.lua
1245
-- Created 10/6/2014
1246
-- Author: Quenty
1247
-- Version 1.0.3
1248
1249
-- Updated 10/14/2014 - Updated to 1.0.1
1250
--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
1251
1252
-- Updated 10/14/2014 - Updated to 1.0.2
1253
--- Fixed bug fix. 
1254
1255
-- Updated 10/14/2014 - Updated to 1.0.3
1256
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
1257
1258
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
1259
1260
1261
local function CallOnChildren(Instance, FunctionToCall)
1262
	-- Calls a function on each of the children of a certain object, using recursion.  
1263
1264
	FunctionToCall(Instance)
1265
1266
	for _, Child in next, Instance:GetChildren() do
1267
		CallOnChildren(Child, FunctionToCall)
1268
	end
1269
end
1270
1271
local function GetNearestParent(Instance, ClassName)
1272
	-- Returns the nearest parent of a certain class, or returns nil
1273
1274
	local Ancestor = Instance
1275
	repeat
1276
		Ancestor = Ancestor.Parent
1277
		if Ancestor == nil then
1278
			return nil
1279
		end
1280
	until Ancestor:IsA(ClassName)
1281
1282
	return Ancestor
1283
end
1284
1285
local function GetBricks(StartInstance)
1286
	local List = {}
1287
1288
	-- if StartInstance:IsA("BasePart") then
1289
	-- 	List[#List+1] = StartInstance
1290
	-- end
1291
1292
	CallOnChildren(StartInstance, function(Item)
1293
		if Item:IsA("BasePart") then
1294
			List[#List+1] = Item;
1295
		end
1296
	end)
1297
1298
	return List
1299
end
1300
1301
local function Modify(Instance, Values)
1302
	-- Modifies an Instance by using a table.  
1303
1304
	assert(type(Values) == "table", "Values is not a table");
1305
1306
	for Index, Value in next, Values do
1307
		if type(Index) == "number" then
1308
			Value.Parent = Instance
1309
		else
1310
			Instance[Index] = Value
1311
		end
1312
	end
1313
	return Instance
1314
end
1315
1316
local function Make(ClassType, Properties)
1317
	-- Using a syntax hack to create a nice way to Make new items.  
1318
1319
	return Modify(Instance.new(ClassType), Properties)
1320
end
1321
1322
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
1323
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
1324
1325
local function HasWheelJoint(Part)
1326
	for _, SurfaceName in pairs(Surfaces) do
1327
		for _, HingSurfaceName in pairs(HingSurfaces) do
1328
			if Part[SurfaceName].Name == HingSurfaceName then
1329
				return true
1330
			end
1331
		end
1332
	end
1333
	
1334
	return false
1335
end
1336
1337
local function ShouldBreakJoints(Part)
1338
	--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
1339
	--  definitely some edge cases. 
1340
1341
	if NEVER_BREAK_JOINTS then
1342
		return false
1343
	end
1344
	
1345
	if HasWheelJoint(Part) then
1346
		return false
1347
	end
1348
	
1349
	local Connected = Part:GetConnectedParts()
1350
	
1351
	if #Connected == 1 then
1352
		return false
1353
	end
1354
	
1355
	for _, Item in pairs(Connected) do
1356
		if HasWheelJoint(Item) then
1357
			return false
1358
		elseif not Item:IsDescendantOf(script.Parent) then
1359
			return false
1360
		end
1361
	end
1362
	
1363
	return true
1364
end
1365
1366
local function WeldTogether(Part0, Part1, JointType, WeldParent)
1367
	--- Weld's 2 parts together
1368
	-- @param Part0 The first part
1369
	-- @param Part1 The second part (Dependent part most of the time).
1370
	-- @param [JointType] The type of joint. Defaults to weld.
1371
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
1372
	-- @return The weld created.
1373
1374
	JointType = JointType or "Weld"
1375
	local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
1376
	
1377
	local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
1378
	Modify(NewWeld, {
1379
		Name = "qCFrameWeldThingy";
1380
		Part0  = Part0;
1381
		Part1  = Part1;
1382
		C0     = CFrame.new();--Part0.CFrame:inverse();
1383
		C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
1384
		Parent = Part1;
1385
	})
1386
1387
	if not RelativeValue then
1388
		RelativeValue = Make("CFrameValue", {
1389
			Parent     = Part1;
1390
			Name       = "qRelativeCFrameWeldValue";
1391
			Archivable = true;
1392
			Value      = NewWeld.C1;
1393
		})
1394
	end
1395
1396
	return NewWeld
1397
end
1398
1399
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
1400
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
1401
	-- @param MainPart The part to weld the model to (can be in the model).
1402
	-- @param [JointType] The type of joint. Defaults to weld. 
1403
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
1404
	
1405
	for _, Part in pairs(Parts) do
1406
		if ShouldBreakJoints(Part) then
1407
			Part:BreakJoints()
1408
		end
1409
	end
1410
	
1411
	for _, Part in pairs(Parts) do
1412
		if Part ~= MainPart then
1413
			WeldTogether(MainPart, Part, JointType, MainPart)
1414
		end
1415
	end
1416
1417
	if not DoNotUnanchor then
1418
		for _, Part in pairs(Parts) do
1419
			Part.Anchored = false
1420
		end
1421
		MainPart.Anchored = false
1422
	end
1423
end
1424
1425
local function PerfectionWeld()	
1426
	local Tool = GetNearestParent(script, "Tool")
1427
1428
	local Parts = GetBricks(script.Parent)
1429
	local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
1430
1431
	if PrimaryPart then
1432
		WeldParts(Parts, PrimaryPart, "Weld", false)
1433
	else
1434
		warn("qWeld - Unable to weld part")
1435
	end
1436
	
1437
	return Tool
1438
end
1439
1440
local Tool = PerfectionWeld()
1441
1442
1443
if Tool and script.ClassName == "Script" then
1444
	--- Don't bother with local scripts
1445
1446
	script.Parent.AncestryChanged:connect(function()
1447
		PerfectionWeld()
1448
	end)
1449
end
1450
1451
-- Created by Quenty (@Quenty, follow me on twitter).
1452
1453
end))
1454
Motor6D40.Name = "RightWrist"
1455
Motor6D40.Parent = MeshPart35
1456
Motor6D40.C0 = CFrame.new(0.014524051, -4.61915302, -0.067019932, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1457
Motor6D40.C1 = CFrame.new(0.00585886789, 0.393527001, -0.104560249, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1458
Motor6D40.Part0 = MeshPart41
1459
Motor6D40.Part1 = MeshPart35
1460
Motor6D40.part1 = MeshPart35
1461
MeshPart41.Name = "RightLowerArm"
1462
MeshPart41.Parent = Model0
1463
MeshPart41.CFrame = CFrame.new(-44.8363304, 19.6875648, 52.6874084, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1464
MeshPart41.Orientation = Vector3.new(0, -89.9599991, 0)
1465
MeshPart41.Position = Vector3.new(-44.8363304, 19.6875648, 52.6874084)
1466
MeshPart41.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1467
MeshPart41.Color = Color3.new(0.960784, 0.803922, 0.188235)
1468
MeshPart41.Size = Vector3.new(6.77433443, 8.5717144, 6.77415848)
1469
MeshPart41.BrickColor = BrickColor.new("Bright yellow")
1470
MeshPart41.CanCollide = false
1471
MeshPart41.brickColor = BrickColor.new("Bright yellow")
1472
Vector3Value42.Name = "OriginalSize"
1473
Vector3Value42.Parent = MeshPart41
1474
Vector3Value42.Value = Vector3.new(1.00027657, 1.26567209, 1.00025082)
1475
Script43.Name = "Hurting"
1476
Script43.Parent = MeshPart41
1477
table.insert(cors,sandbox(Script43,function()
1478
function onTouched(hit)
1479
	local humanoid = hit.Parent:findFirstChild("Humanoid")
1480
	if (humanoid ~= nil) then
1481
		humanoid.Health = humanoid.Health - 25
1482
	end
1483
end
1484
1485
script.Parent.Touched:connect(onTouched)
1486
end))
1487
Script44.Name = "ShieldScript"
1488
Script44.Parent = MeshPart41
1489
table.insert(cors,sandbox(Script44,function()
1490
function ot(hit)
1491
	ch = hit:GetChildren()
1492
	for i = 1, #ch do
1493
		if ch[i].className == "BodyVelocity" then
1494
			ch[i].velocity = ch[i].velocity*-1
1495
		end
1496
	end
1497
	if hit.Parent ~= nil then
1498
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1499
			if hit.Parent ~= script.Parent.Parent then
1500
				if hit.Parent:FindFirstChild("Torso") ~= nil then
1501
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1502
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1503
				end
1504
				hit.Parent.Humanoid.PlatformStand = true
1505
			end
1506
		else
1507
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
1508
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
1509
					hit:breakJoints()
1510
					if hit.Anchored == false then
1511
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1512
					end
1513
				end
1514
			else
1515
				hit:breakJoints()
1516
				if hit.Anchored == false then
1517
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1518
				end
1519
			end
1520
		end
1521
	end
1522
	if hit.Parent ~= nil then
1523
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1524
			if hit.Parent ~= script.Parent.Parent then
1525
				wait(0.5)
1526
				hit.Parent.Humanoid.PlatformStand = false
1527
			end
1528
		end
1529
	end
1530
end
1531
function remove(child)
1532
	child:Remove()
1533
end
1534
script.Parent.Touched:connect(ot)
1535
script.Parent.ChildAdded:connect(remove)
1536
end))
1537
Motor6D45.Name = "RightElbow"
1538
Motor6D45.Parent = MeshPart41
1539
Motor6D45.C0 = CFrame.new(0.0145200128, -1.78210199, -0.0639328733, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1540
Motor6D45.C1 = CFrame.new(0.014524051, 0.832677782, -0.067019932, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1541
Motor6D45.Part0 = MeshPart49
1542
Motor6D45.Part1 = MeshPart41
1543
Motor6D45.part1 = MeshPart41
1544
MeshPart46.Name = "RightLowerLeg"
1545
MeshPart46.Parent = Model0
1546
MeshPart46.CFrame = CFrame.new(-44.87714, 6.16495991, 45.9358368, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1547
MeshPart46.Orientation = Vector3.new(0, -89.9599991, 0)
1548
MeshPart46.Position = Vector3.new(-44.87714, 6.16495991, 45.9358368)
1549
MeshPart46.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1550
MeshPart46.Color = Color3.new(0.294118, 0.592157, 0.294118)
1551
MeshPart46.Size = Vector3.new(6.77432919, 10.088563, 6.77468538)
1552
MeshPart46.BrickColor = BrickColor.new("Bright green")
1553
MeshPart46.CanCollide = false
1554
MeshPart46.brickColor = BrickColor.new("Bright green")
1555
Vector3Value47.Name = "OriginalSize"
1556
Vector3Value47.Parent = MeshPart46
1557
Vector3Value47.Value = Vector3.new(1.00027585, 1.48964536, 1.00032854)
1558
Motor6D48.Name = "RightKnee"
1559
Motor6D48.Parent = MeshPart46
1560
Motor6D48.C0 = CFrame.new(0.0259127952, -1.7952857, 0.00289178547, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1561
Motor6D48.C1 = CFrame.new(0.0259127952, 1.95906019, 0.000987774343, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1562
Motor6D48.Part0 = MeshPart52
1563
Motor6D48.Part1 = MeshPart46
1564
Motor6D48.part1 = MeshPart46
1565
MeshPart49.Name = "RightUpperArm"
1566
MeshPart49.Parent = Model0
1567
MeshPart49.CFrame = CFrame.new(-44.8331604, 22.3023453, 52.687458, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1568
MeshPart49.Orientation = Vector3.new(0, -89.9599991, 0)
1569
MeshPart49.Position = Vector3.new(-44.8331604, 22.3023453, 52.687458)
1570
MeshPart49.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1571
MeshPart49.Color = Color3.new(1, 1, 0)
1572
MeshPart49.Size = Vector3.new(6.77433252, 9.45123863, 6.77415848)
1573
MeshPart49.BrickColor = BrickColor.new("New Yeller")
1574
MeshPart49.CanCollide = false
1575
MeshPart49.brickColor = BrickColor.new("New Yeller")
1576
Vector3Value50.Name = "OriginalSize"
1577
Vector3Value50.Parent = MeshPart49
1578
Vector3Value50.Value = Vector3.new(1.00027633, 1.39554, 1.00025082)
1579
Motor6D51.Name = "RightShoulder"
1580
Motor6D51.Parent = MeshPart49
1581
Motor6D51.C0 = CFrame.new(8.46773338, 3.76923919, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1582
Motor6D51.C1 = CFrame.new(-1.67872834, 3.09419036, -0.0639328733, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1583
Motor6D51.Part0 = MeshPart57
1584
Motor6D51.Part1 = MeshPart49
1585
Motor6D51.part1 = MeshPart49
1586
MeshPart52.Name = "RightUpperLeg"
1587
MeshPart52.Parent = Model0
1588
MeshPart52.CFrame = CFrame.new(-44.8751183, 9.9193058, 45.9359055, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1589
MeshPart52.Orientation = Vector3.new(0, -89.9599991, 0)
1590
MeshPart52.Position = Vector3.new(-44.8751183, 9.9193058, 45.9359055)
1591
MeshPart52.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1592
MeshPart52.Color = Color3.new(0, 1, 0)
1593
MeshPart52.Size = Vector3.new(6.7743268, 10.4042921, 6.77875233)
1594
MeshPart52.BrickColor = BrickColor.new("Lime green")
1595
MeshPart52.CanCollide = false
1596
MeshPart52.brickColor = BrickColor.new("Lime green")
1597
Vector3Value53.Name = "OriginalSize"
1598
Vector3Value53.Parent = MeshPart52
1599
Vector3Value53.Value = Vector3.new(1.00027561, 1.5362649, 1.00092912)
1600
Motor6D54.Name = "RightHip"
1601
Motor6D54.Parent = MeshPart52
1602
Motor6D54.C0 = CFrame.new(3.42063618, -1.64748406, 0.00696135359, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1603
Motor6D54.C1 = CFrame.new(0.0259127952, 3.28405929, 0.00329693779, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1604
Motor6D54.Part0 = MeshPart23
1605
Motor6D54.Part1 = MeshPart52
1606
Motor6D54.part1 = MeshPart52
1607
IntValue55.Name = "Mode"
1608
IntValue55.Parent = Model0
1609
Humanoid56.Name = "NPC"
1610
Humanoid56.Parent = Model0
1611
Humanoid56.Health = 15000
1612
Humanoid56.HealthDisplayDistance = 0
1613
Humanoid56.HipHeight = 7.5
1614
Humanoid56.JumpPower = 100
1615
Humanoid56.MaxHealth = 15000
1616
Humanoid56.MaxSlopeAngle = 89.900001525879
1617
Humanoid56.NameDisplayDistance = 0
1618
Humanoid56.NameOcclusion = Enum.NameOcclusion.EnemyOcclusion
1619
Humanoid56.RigType = Enum.HumanoidRigType.R15
1620
Humanoid56.Torso = Part64
1621
Humanoid56.WalkSpeed = 40
1622
Humanoid56.maxHealth = 15000
1623
MeshPart57.Name = "UpperTorso"
1624
MeshPart57.Parent = Model0
1625
MeshPart57.CFrame = CFrame.new(-44.8824272, 21.627491, 42.5410194, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1626
MeshPart57.Orientation = Vector3.new(0, -89.9599991, 0)
1627
MeshPart57.Position = Vector3.new(-44.8824272, 21.627491, 42.5410194)
1628
MeshPart57.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1629
MeshPart57.Color = Color3.new(0, 0, 1)
1630
MeshPart57.Size = Vector3.new(13.5468998, 10.8422594, 6.77609539)
1631
MeshPart57.BrickColor = BrickColor.new("Really blue")
1632
MeshPart57.brickColor = BrickColor.new("Really blue")
1633
Vector3Value58.Name = "OriginalSize"
1634
Vector3Value58.Parent = MeshPart57
1635
Vector3Value58.Value = Vector3.new(2.00029206, 1.60093355, 1.0005368)
1636
Script59.Name = "Damage Script"
1637
Script59.Parent = MeshPart57
1638
table.insert(cors,sandbox(Script59,function()
1639
function onTouched(hit)
1640
        local human = hit.Parent:findFirstChild("Humanoid")
1641
        if (human ~= nil) then
1642
                human.Health = human.Health - 5 -- Change the amount to change the damage.
1643
        end
1644
end
1645
script.Parent.Touched:connect(onTouched)
1646
end))
1647
Script60.Name = "Hurting"
1648
Script60.Parent = MeshPart57
1649
table.insert(cors,sandbox(Script60,function()
1650
function onTouched(hit)
1651
	local humanoid = hit.Parent:findFirstChild("Humanoid")
1652
	if (humanoid ~= nil) then
1653
		humanoid.Health = humanoid.Health - 25
1654
	end
1655
end
1656
1657
script.Parent.Touched:connect(onTouched)
1658
end))
1659
Script61.Name = "ShieldScript"
1660
Script61.Parent = MeshPart57
1661
table.insert(cors,sandbox(Script61,function()
1662
function ot(hit)
1663
	ch = hit:GetChildren()
1664
	for i = 1, #ch do
1665
		if ch[i].className == "BodyVelocity" then
1666
			ch[i].velocity = ch[i].velocity*-1
1667
		end
1668
	end
1669
	if hit.Parent ~= nil then
1670
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1671
			if hit.Parent ~= script.Parent.Parent then
1672
				if hit.Parent:FindFirstChild("Torso") ~= nil then
1673
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1674
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1675
				end
1676
				hit.Parent.Humanoid.PlatformStand = true
1677
			end
1678
		else
1679
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
1680
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
1681
					hit:breakJoints()
1682
					if hit.Anchored == false then
1683
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1684
					end
1685
				end
1686
			else
1687
				hit:breakJoints()
1688
				if hit.Anchored == false then
1689
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1690
				end
1691
			end
1692
		end
1693
	end
1694
	if hit.Parent ~= nil then
1695
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1696
			if hit.Parent ~= script.Parent.Parent then
1697
				wait(0.5)
1698
				hit.Parent.Humanoid.PlatformStand = false
1699
			end
1700
		end
1701
	end
1702
end
1703
function remove(child)
1704
	child:Remove()
1705
end
1706
script.Parent.Touched:connect(ot)
1707
script.Parent.ChildAdded:connect(remove)
1708
end))
1709
Motor6D62.Name = "Waist"
1710
Motor6D62.Parent = MeshPart57
1711
Motor6D62.C0 = CFrame.new(0.00189745135, 3.63778567, -0.0966572911, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1712
Motor6D62.C1 = CFrame.new(0.0022898186, -3.13879156, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
1713
Motor6D62.Part0 = MeshPart23
1714
Motor6D62.Part1 = MeshPart57
1715
Motor6D62.part1 = MeshPart57
1716
Script63.Name = "Read me"
1717
Script63.Parent = Model0
1718
table.insert(cors,sandbox(Script63,function()
1719
--| Help for R15 model Zombie |--
1720
--
1721
-- To edit the zombie's damage go to LeftLowerArm/RightLowerArm > Damage Script > human.Health = human.Health - 5
1722
--                                                                                              Edit the number to whatever you'd like
1723
-- The player will recieve damage from the LeftLowerArm and RightLowerArm
1724
-- To edit the walkspeed go to Humanoid > Scroll to the bottom > Edit the number shown after WalkSpeed
1725
-- You can also edit max health and spawn health under Humanoid > game
1726
--
1727
-- Have fun!
1728
--
1729
-- ImFarAway
1730
end))
1731
Part64.Name = "HumanoidRootPart"
1732
Part64.Parent = Model0
1733
Part64.CFrame = CFrame.new(-44.7772217, 15.7519035, 42.5431137, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
1734
Part64.Orientation = Vector3.new(0, -89.9599991, 0)
1735
Part64.Position = Vector3.new(-44.7772217, 15.7519035, 42.5431137)
1736
Part64.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
1737
Part64.Color = Color3.new(0.294118, 0.592157, 0.294118)
1738
Part64.Transparency = 1
1739
Part64.Size = Vector3.new(13.5449219, 13.5449219, 6.77246094)
1740
Part64.BrickColor = BrickColor.new("Bright green")
1741
Part64.CanCollide = false
1742
Part64.brickColor = BrickColor.new("Bright green")
1743
Vector3Value65.Name = "OriginalSize"
1744
Vector3Value65.Parent = Part64
1745
Vector3Value65.Value = Vector3.new(2, 2, 1)
1746
Script66.Name = "ShieldScript"
1747
Script66.Parent = Part64
1748
table.insert(cors,sandbox(Script66,function()
1749
function ot(hit)
1750
	ch = hit:GetChildren()
1751
	for i = 1, #ch do
1752
		if ch[i].className == "BodyVelocity" then
1753
			ch[i].velocity = ch[i].velocity*-1
1754
		end
1755
	end
1756
	if hit.Parent ~= nil then
1757
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1758
			if hit.Parent ~= script.Parent.Parent then
1759
				if hit.Parent:FindFirstChild("Torso") ~= nil then
1760
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1761
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
1762
				end
1763
				hit.Parent.Humanoid.PlatformStand = true
1764
			end
1765
		else
1766
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
1767
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
1768
					hit:breakJoints()
1769
					if hit.Anchored == false then
1770
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1771
					end
1772
				end
1773
			else
1774
				hit:breakJoints()
1775
				if hit.Anchored == false then
1776
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
1777
				end
1778
			end
1779
		end
1780
	end
1781
	if hit.Parent ~= nil then
1782
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
1783
			if hit.Parent ~= script.Parent.Parent then
1784
				wait(0.5)
1785
				hit.Parent.Humanoid.PlatformStand = false
1786
			end
1787
		end
1788
	end
1789
end
1790
function remove(child)
1791
	child:Remove()
1792
end
1793
script.Parent.Touched:connect(ot)
1794
script.Parent.ChildAdded:connect(remove)
1795
end))
1796
Script67.Name = "Hurting"
1797
Script67.Parent = Part64
1798
table.insert(cors,sandbox(Script67,function()
1799
function onTouched(hit)
1800
	local humanoid = hit.Parent:findFirstChild("Humanoid")
1801
	if (humanoid ~= nil) then
1802
		humanoid.Health = humanoid.Health - 25
1803
	end
1804
end
1805
1806
script.Parent.Touched:connect(onTouched)
1807
end))
1808
Part68.Name = "Scary Popup"
1809
Part68.Parent = Part64
1810
Part68.CFrame = CFrame.new(-42.9161453, 12.918376, 42.8049088, 1.29615285e-06, -6.0259481e-08, -1, -1.70004219e-10, 1, -6.0259481e-08, 1, 1.70082337e-10, 1.29615285e-06)
1811
Part68.Orientation = Vector3.new(0, -90, 0)
1812
Part68.Position = Vector3.new(-42.9161453, 12.918376, 42.8049088)
1813
Part68.Rotation = Vector3.new(0, -90, 0)
1814
Part68.Color = Color3.new(0.388235, 0.372549, 0.384314)
1815
Part68.Transparency = 1
1816
Part68.Size = Vector3.new(13.8900099, 25.7999935, 2.60000205)
1817
Part68.Anchored = true
1818
Part68.BrickColor = BrickColor.new("Dark stone grey")
1819
Part68.CanCollide = false
1820
Part68.brickColor = BrickColor.new("Dark stone grey")
1821
Part68.FormFactor = Enum.FormFactor.Custom
1822
Part68.formFactor = Enum.FormFactor.Custom
1823
Script69.Name = "ScaryScript"
1824
Script69.Parent = Part68
1825
table.insert(cors,sandbox(Script69,function()
1826
Sound = script.Parent.Scream
1827
Popup = script.Parent.Popup
1828
Ready = true
1829
function onTouch(hit)
1830
local h = hit.Parent:FindFirstChild("Humanoid")
1831
if h ~= nil and Ready == true then
1832
Ready = false
1833
local plyr = game.Players:FindFirstChild(h.Parent.Name)
1834
local c = Popup:clone()
1835
c.Parent = plyr.PlayerGui
1836
script.Parent.Scream:play()
1837
wait(7)
1838
c:remove()
1839
wait(1)
1840
Ready = true
1841
end
1842
end
1843
1844
script.Parent.Touched:connect(onTouch)
1845
1846
end))
1847
ScreenGui70.Name = "Popup"
1848
ScreenGui70.Parent = Part68
1849
Frame71.Name = "BackGround"
1850
Frame71.Parent = ScreenGui70
1851
Frame71.Transparency = 1
1852
Frame71.Size = UDim2.new(1, 1, 1, 1)
1853
Frame71.BackgroundColor = BrickColor.new("Black metallic")
1854
Frame71.BackgroundColor3 = Color3.new(0.109804, 0.109804, 0.109804)
1855
Frame71.BackgroundTransparency = 1
1856
ImageLabel72.Name = "Image"
1857
ImageLabel72.Parent = Frame71
1858
ImageLabel72.Transparency = 1
1859
ImageLabel72.Size = UDim2.new(1, 1, 1, 1)
1860
ImageLabel72.BackgroundColor = BrickColor.new("Really black")
1861
ImageLabel72.BackgroundColor3 = Color3.new(0, 0, 0)
1862
ImageLabel72.BackgroundTransparency = 1
1863
ImageLabel72.ImageTransparency = 1
1864
Sound73.Name = "Scream"
1865
Sound73.Parent = Part68
1866
Sound73.TimePosition = 0.3
1867
Sound73.EmitterSize = 500
1868
Sound73.MinDistance = 500
1869
Sound73.SoundId = "rbxassetid://154157312"
1870
Sound73.Volume = 10
1871
Script74.Name = "qPerfectionWeld"
1872
Script74.Parent = Part64
1873
table.insert(cors,sandbox(Script74,function()
1874
-- Created by Quenty (@Quenty, follow me on twitter).
1875
-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
1876
-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
1877
1878
--[[ INSTRUCTIONS
1879
- Place in the model
1880
- Make sure model is anchored
1881
- That's it. It will weld the model and all children. 
1882
1883
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1884
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1885
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1886
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1887
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1888
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1889
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1890
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
1891
1892
This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes. 
1893
]]
1894
1895
--[[ DOCUMENTATION
1896
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
1897
- Will work in PBS servers
1898
- Will work as long as it starts out with the part anchored
1899
- Stores the relative CFrame as a CFrame value
1900
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
1901
- Utilizes a recursive algorith to find all parts in the model
1902
- Will reweld on script reparent if the script is initially parented to a tool.
1903
- Welds as fast as possible
1904
]]
1905
1906
-- qPerfectionWeld.lua
1907
-- Created 10/6/2014
1908
-- Author: Quenty
1909
-- Version 1.0.3
1910
1911
-- Updated 10/14/2014 - Updated to 1.0.1
1912
--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
1913
1914
-- Updated 10/14/2014 - Updated to 1.0.2
1915
--- Fixed bug fix. 
1916
1917
-- Updated 10/14/2014 - Updated to 1.0.3
1918
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
1919
1920
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
1921
1922
1923
local function CallOnChildren(Instance, FunctionToCall)
1924
	-- Calls a function on each of the children of a certain object, using recursion.  
1925
1926
	FunctionToCall(Instance)
1927
1928
	for _, Child in next, Instance:GetChildren() do
1929
		CallOnChildren(Child, FunctionToCall)
1930
	end
1931
end
1932
1933
local function GetNearestParent(Instance, ClassName)
1934
	-- Returns the nearest parent of a certain class, or returns nil
1935
1936
	local Ancestor = Instance
1937
	repeat
1938
		Ancestor = Ancestor.Parent
1939
		if Ancestor == nil then
1940
			return nil
1941
		end
1942
	until Ancestor:IsA(ClassName)
1943
1944
	return Ancestor
1945
end
1946
1947
local function GetBricks(StartInstance)
1948
	local List = {}
1949
1950
	-- if StartInstance:IsA("BasePart") then
1951
	-- 	List[#List+1] = StartInstance
1952
	-- end
1953
1954
	CallOnChildren(StartInstance, function(Item)
1955
		if Item:IsA("BasePart") then
1956
			List[#List+1] = Item;
1957
		end
1958
	end)
1959
1960
	return List
1961
end
1962
1963
local function Modify(Instance, Values)
1964
	-- Modifies an Instance by using a table.  
1965
1966
	assert(type(Values) == "table", "Values is not a table");
1967
1968
	for Index, Value in next, Values do
1969
		if type(Index) == "number" then
1970
			Value.Parent = Instance
1971
		else
1972
			Instance[Index] = Value
1973
		end
1974
	end
1975
	return Instance
1976
end
1977
1978
local function Make(ClassType, Properties)
1979
	-- Using a syntax hack to create a nice way to Make new items.  
1980
1981
	return Modify(Instance.new(ClassType), Properties)
1982
end
1983
1984
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
1985
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
1986
1987
local function HasWheelJoint(Part)
1988
	for _, SurfaceName in pairs(Surfaces) do
1989
		for _, HingSurfaceName in pairs(HingSurfaces) do
1990
			if Part[SurfaceName].Name == HingSurfaceName then
1991
				return true
1992
			end
1993
		end
1994
	end
1995
	
1996
	return false
1997
end
1998
1999
local function ShouldBreakJoints(Part)
2000
	--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
2001
	--  definitely some edge cases. 
2002
2003
	if NEVER_BREAK_JOINTS then
2004
		return false
2005
	end
2006
	
2007
	if HasWheelJoint(Part) then
2008
		return false
2009
	end
2010
	
2011
	local Connected = Part:GetConnectedParts()
2012
	
2013
	if #Connected == 1 then
2014
		return false
2015
	end
2016
	
2017
	for _, Item in pairs(Connected) do
2018
		if HasWheelJoint(Item) then
2019
			return false
2020
		elseif not Item:IsDescendantOf(script.Parent) then
2021
			return false
2022
		end
2023
	end
2024
	
2025
	return true
2026
end
2027
2028
local function WeldTogether(Part0, Part1, JointType, WeldParent)
2029
	--- Weld's 2 parts together
2030
	-- @param Part0 The first part
2031
	-- @param Part1 The second part (Dependent part most of the time).
2032
	-- @param [JointType] The type of joint. Defaults to weld.
2033
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
2034
	-- @return The weld created.
2035
2036
	JointType = JointType or "Weld"
2037
	local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
2038
	
2039
	local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
2040
	Modify(NewWeld, {
2041
		Name = "qCFrameWeldThingy";
2042
		Part0  = Part0;
2043
		Part1  = Part1;
2044
		C0     = CFrame.new();--Part0.CFrame:inverse();
2045
		C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
2046
		Parent = Part1;
2047
	})
2048
2049
	if not RelativeValue then
2050
		RelativeValue = Make("CFrameValue", {
2051
			Parent     = Part1;
2052
			Name       = "qRelativeCFrameWeldValue";
2053
			Archivable = true;
2054
			Value      = NewWeld.C1;
2055
		})
2056
	end
2057
2058
	return NewWeld
2059
end
2060
2061
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
2062
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
2063
	-- @param MainPart The part to weld the model to (can be in the model).
2064
	-- @param [JointType] The type of joint. Defaults to weld. 
2065
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
2066
	
2067
	for _, Part in pairs(Parts) do
2068
		if ShouldBreakJoints(Part) then
2069
			Part:BreakJoints()
2070
		end
2071
	end
2072
	
2073
	for _, Part in pairs(Parts) do
2074
		if Part ~= MainPart then
2075
			WeldTogether(MainPart, Part, JointType, MainPart)
2076
		end
2077
	end
2078
2079
	if not DoNotUnanchor then
2080
		for _, Part in pairs(Parts) do
2081
			Part.Anchored = false
2082
		end
2083
		MainPart.Anchored = false
2084
	end
2085
end
2086
2087
local function PerfectionWeld()	
2088
	local Tool = GetNearestParent(script, "Tool")
2089
2090
	local Parts = GetBricks(script.Parent)
2091
	local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
2092
2093
	if PrimaryPart then
2094
		WeldParts(Parts, PrimaryPart, "Weld", false)
2095
	else
2096
		warn("qWeld - Unable to weld part")
2097
	end
2098
	
2099
	return Tool
2100
end
2101
2102
local Tool = PerfectionWeld()
2103
2104
2105
if Tool and script.ClassName == "Script" then
2106
	--- Don't bother with local scripts
2107
2108
	script.Parent.AncestryChanged:connect(function()
2109
		PerfectionWeld()
2110
	end)
2111
end
2112
2113
-- Created by Quenty (@Quenty, follow me on twitter).
2114
2115
end))
2116
Part75.Name = "Head"
2117
Part75.Parent = Model0
2118
Part75.CFrame = CFrame.new(-44.7505646, 30.9169159, 42.5435677, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
2119
Part75.Orientation = Vector3.new(0, -89.9599991, 0)
2120
Part75.Position = Vector3.new(-44.7505646, 30.9169159, 42.5435677)
2121
Part75.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
2122
Part75.Color = Color3.new(0.960784, 0.803922, 0.188235)
2123
Part75.Size = Vector3.new(6.77246094, 6.77246094, 6.77246094)
2124
Part75.BottomSurface = Enum.SurfaceType.Smooth
2125
Part75.BrickColor = BrickColor.new("Bright yellow")
2126
Part75.TopSurface = Enum.SurfaceType.Smooth
2127
Part75.brickColor = BrickColor.new("Bright yellow")
2128
Part75.FormFactor = Enum.FormFactor.Custom
2129
Part75.formFactor = Enum.FormFactor.Custom
2130
Vector3Value76.Name = "OriginalSize"
2131
Vector3Value76.Parent = Part75
2132
Vector3Value76.Value = Vector3.new(1, 1, 1)
2133
Script77.Name = "ShieldScript"
2134
Script77.Parent = Part75
2135
table.insert(cors,sandbox(Script77,function()
2136
function ot(hit)
2137
	ch = hit:GetChildren()
2138
	for i = 1, #ch do
2139
		if ch[i].className == "BodyVelocity" then
2140
			ch[i].velocity = ch[i].velocity*-1
2141
		end
2142
	end
2143
	if hit.Parent ~= nil then
2144
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
2145
			if hit.Parent ~= script.Parent.Parent then
2146
				if hit.Parent:FindFirstChild("Torso") ~= nil then
2147
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
2148
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
2149
				end
2150
				hit.Parent.Humanoid.PlatformStand = true
2151
			end
2152
		else
2153
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
2154
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
2155
					hit:breakJoints()
2156
					if hit.Anchored == false then
2157
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
2158
					end
2159
				end
2160
			else
2161
				hit:breakJoints()
2162
				if hit.Anchored == false then
2163
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
2164
				end
2165
			end
2166
		end
2167
	end
2168
	if hit.Parent ~= nil then
2169
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
2170
			if hit.Parent ~= script.Parent.Parent then
2171
				wait(0.5)
2172
				hit.Parent.Humanoid.PlatformStand = false
2173
			end
2174
		end
2175
	end
2176
end
2177
function remove(child)
2178
	child:Remove()
2179
end
2180
script.Parent.Touched:connect(ot)
2181
script.Parent.ChildAdded:connect(remove)
2182
end))
2183
Script78.Name = "Hurting"
2184
Script78.Parent = Part75
2185
table.insert(cors,sandbox(Script78,function()
2186
function onTouched(hit)
2187
	local humanoid = hit.Parent:findFirstChild("Humanoid")
2188
	if (humanoid ~= nil) then
2189
		humanoid.Health = humanoid.Health - 25
2190
	end
2191
end
2192
2193
script.Parent.Touched:connect(onTouched)
2194
end))
2195
SpecialMesh79.Parent = Part75
2196
SpecialMesh79.MeshId = "rbxassetid://1047997"
2197
SpecialMesh79.Scale = Vector3.new(6.03900242, 5.49000359, 5.79500103)
2198
SpecialMesh79.TextureId = "rbxassetid://1047998"
2199
SpecialMesh79.MeshType = Enum.MeshType.FileMesh
2200
Motor6D80.Name = "Neck"
2201
Motor6D80.Parent = Part75
2202
Motor6D80.C0 = CFrame.new(0.0022898186, 5.4588213, -0.105385743, 1, 0, 0, 0, 1, 0, 0, 0, 1)
2203
Motor6D80.C1 = CFrame.new(-0.000184275414, -3.83060861, 0.026188096, 1, 0, 0, 0, 1, 0, 0, 0, 1)
2204
Motor6D80.Part0 = MeshPart57
2205
Motor6D80.Part1 = Part75
2206
Motor6D80.part1 = Part75
2207
Script81.Name = "Sound"
2208
Script81.Parent = Model0
2209
table.insert(cors,sandbox(Script81,function()
2210
--[[
2211
	Author: @spotco
2212
	This script creates sounds which are placed under the character head.
2213
	These sounds are used by the "LocalSound" script.
2214
	
2215
	To modify this script, copy it to your "StarterPlayer/StarterCharacterScripts" folder keeping the same script name ("Sound").
2216
	The default Sound script loaded for every character will then be replaced with your copy of the script.
2217
]]--
2218
2219
function CreateNewSound(name, id, looped, pitch, parent)
2220
	local sound = Instance.new("Sound")
2221
	sound.SoundId = id
2222
	sound.Name = name
2223
	sound.archivable = false
2224
	sound.Parent = parent
2225
	sound.Pitch = pitch
2226
	sound.Looped = looped
2227
	
2228
	sound.MinDistance = 5
2229
	sound.MaxDistance = 150
2230
	sound.Volume = 0.65
2231
	
2232
	return sound
2233
end
2234
2235
local head = script.Parent:FindFirstChild("Head")
2236
if head == nil then
2237
	error("Sound script parent has no child Head.")
2238
	return
2239
end
2240
2241
2242
CreateNewSound("GettingUp", 	"rbxasset://sounds/action_get_up.mp3",					false, 	1,		head)
2243
CreateNewSound("Died", 		"rbxasset://sounds/uuhhh.mp3",							false, 	1,		head) 
2244
CreateNewSound("FreeFalling", 	"rbxasset://sounds/action_falling.mp3",				true,	1,		head)
2245
CreateNewSound("Jumping", 		"rbxasset://sounds/action_jump.mp3",					false,	1,		head)
2246
CreateNewSound("Landing", 		"rbxasset://sounds/action_jump_land.mp3",				false,	1,		head)
2247
CreateNewSound("Splash", 		"rbxasset://sounds/impact_water.mp3",					false, 	1,		head)
2248
CreateNewSound("Running", 		"rbxasset://sounds/action_footsteps_plastic.mp3",		true, 	1.85,	head)
2249
CreateNewSound("Swimming", 	"rbxasset://sounds/action_swim.mp3",					true,	1.6,	head)
2250
CreateNewSound("Climbing", 	"rbxasset://sounds/action_footsteps_plastic.mp3",		true,	1,		head)
2251
end))
2252
Script82.Name = "LocalSound"
2253
Script82.Parent = Script81
2254
table.insert(cors,sandbox(Script82,function()
2255
--[[
2256
	Author: @spotco
2257
	This script runs locally for the player of the given humanoid.
2258
	This script triggers humanoid sound play/pause actions locally.
2259
	
2260
	The Playing/TimePosition properties of Sound objects bypass FilteringEnabled, so this triggers the sound
2261
	immediately for the player and is replicated to all other players.
2262
	
2263
	This script is optimized to reduce network traffic through minimizing the amount of property replication.
2264
]]--
2265
2266
--All sounds are referenced by this ID
2267
local SFX = {
2268
	Died = 0;
2269
	Running = 1;
2270
	Swimming = 2;
2271
	Climbing = 3,
2272
	Jumping = 4;
2273
	GettingUp = 5;
2274
	FreeFalling = 6;
2275
	FallingDown = 7;
2276
	Landing = 8;
2277
	Splash = 9;
2278
}
2279
2280
local Humanoid = nil
2281
local Head = nil
2282
2283
--SFX ID to Sound object
2284
local Sounds = {}
2285
2286
do
2287
	local Figure = script.Parent.Parent
2288
	Head = Figure:WaitForChild("Head")
2289
	while not Humanoid do
2290
		for _,NewHumanoid in pairs(Figure:GetChildren()) do
2291
			if NewHumanoid:IsA("Humanoid") then
2292
				Humanoid = NewHumanoid
2293
				break
2294
			end
2295
		end
2296
		Figure.ChildAdded:wait()
2297
	end
2298
	
2299
	Sounds[SFX.Died] = 			Head:WaitForChild("Died")
2300
	Sounds[SFX.Running] = 		Head:WaitForChild("Running")
2301
	Sounds[SFX.Swimming] = 	Head:WaitForChild("Swimming")
2302
	Sounds[SFX.Climbing] = 	Head:WaitForChild("Climbing")
2303
	Sounds[SFX.Jumping] = 		Head:WaitForChild("Jumping")
2304
	Sounds[SFX.GettingUp] = 	Head:WaitForChild("GettingUp")
2305
	Sounds[SFX.FreeFalling] = 	Head:WaitForChild("FreeFalling")
2306
	Sounds[SFX.Landing] = 		Head:WaitForChild("Landing")
2307
	Sounds[SFX.Splash] = 		Head:WaitForChild("Splash")
2308
end
2309
2310
local Util
2311
Util = {
2312
	
2313
	--Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
2314
	YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
2315
		--(y - y1)/(x - x1) = m
2316
		local m = (pt1y - pt2y) / (pt1x - pt2x)
2317
		--float b = pt1.y - m * pt1.x;
2318
		local b = (pt1y - m * pt1x)
2319
		return m * x + b
2320
	end;
2321
	
2322
	--Clamps the value of "val" between the "min" and "max"
2323
	Clamp = function(val,min,max)
2324
		return math.min(max,math.max(min,val))	
2325
	end;
2326
	
2327
	--Gets the horizontal (x,z) velocity magnitude of the given part
2328
	HorizontalSpeed = function(Head)
2329
		local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
2330
		return hVel.magnitude	
2331
	end;
2332
	
2333
	--Gets the vertical (y) velocity magnitude of the given part
2334
	VerticalSpeed = function(Head)
2335
		return math.abs(Head.Velocity.Y)
2336
	end;
2337
	
2338
	--Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
2339
	--If these properties are enabled, use them.
2340
	Play = function(sound)		
2341
		if sound.TimePosition ~= 0 then
2342
			sound.TimePosition = 0
2343
		end
2344
		if not sound.IsPlaying then
2345
			sound.Playing = true
2346
		end
2347
	end;
2348
	Pause = function(sound)
2349
		if sound.IsPlaying then
2350
			sound.Playing = false
2351
		end
2352
	end;
2353
	Resume = function(sound)
2354
		if not sound.IsPlaying then
2355
			sound.Playing = true
2356
		end
2357
	end;
2358
	Stop = function(sound)
2359
		if sound.IsPlaying then
2360
			sound.Playing = false
2361
		end
2362
		if sound.TimePosition ~= 0 then
2363
			sound.TimePosition = 0
2364
		end
2365
	end;
2366
}
2367
2368
do
2369
	-- List of all active Looped sounds
2370
	local playingLoopedSounds = {}
2371
	
2372
	-- Last seen Enum.HumanoidStateType
2373
	local activeState = nil
2374
	
2375
	-- Verify and set that "sound" is in "playingLoopedSounds".
2376
	function setSoundInPlayingLoopedSounds(sound)
2377
		for i=1, #playingLoopedSounds do
2378
			if playingLoopedSounds[i] == sound then
2379
				return
2380
			end
2381
		end	
2382
		table.insert(playingLoopedSounds,sound)
2383
	end
2384
	
2385
	-- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
2386
	function stopPlayingLoopedSoundsExcept(except)
2387
		for i=#playingLoopedSounds,1,-1 do
2388
			if playingLoopedSounds[i] ~= except then
2389
				Util.Pause(playingLoopedSounds[i])			
2390
				table.remove(playingLoopedSounds,i)	
2391
			end
2392
		end
2393
	end
2394
	
2395
	-- Table of Enum.HumanoidStateType to handling function
2396
	local stateUpdateHandler = {
2397
		[Enum.HumanoidStateType.Dead] = function()
2398
			stopPlayingLoopedSoundsExcept()
2399
			local sound = Sounds[SFX.Died]
2400
			Util.Play(sound)
2401
		end;
2402
		
2403
		[Enum.HumanoidStateType.RunningNoPhysics] = function()
2404
			stateUpdated(Enum.HumanoidStateType.Running)
2405
		end;
2406
		
2407
		[Enum.HumanoidStateType.Running] = function()	
2408
			local sound = Sounds[SFX.Running]
2409
			stopPlayingLoopedSoundsExcept(sound)
2410
			
2411
			if Util.HorizontalSpeed(Head) > 0.5 then
2412
				Util.Resume(sound)
2413
				setSoundInPlayingLoopedSounds(sound)
2414
			else
2415
				stopPlayingLoopedSoundsExcept()
2416
			end
2417
		end;
2418
		
2419
		[Enum.HumanoidStateType.Swimming] = function()
2420
			if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then
2421
				local splashSound = Sounds[SFX.Splash]
2422
				splashSound.Volume = Util.Clamp(
2423
					Util.YForLineGivenXAndTwoPts(
2424
						Util.VerticalSpeed(Head), 
2425
						100, 0.28, 
2426
						350, 1),
2427
					0,1)
2428
				Util.Play(splashSound)
2429
			end
2430
			
2431
			do
2432
				local sound = Sounds[SFX.Swimming]
2433
				stopPlayingLoopedSoundsExcept(sound)
2434
				Util.Resume(sound)
2435
				setSoundInPlayingLoopedSounds(sound)
2436
			end
2437
		end;
2438
		
2439
		[Enum.HumanoidStateType.Climbing] = function()
2440
			local sound = Sounds[SFX.Climbing]
2441
			if Util.VerticalSpeed(Head) > 0.1 then
2442
				Util.Resume(sound)
2443
				stopPlayingLoopedSoundsExcept(sound)
2444
			else
2445
				stopPlayingLoopedSoundsExcept()
2446
			end		
2447
			setSoundInPlayingLoopedSounds(sound)
2448
		end;
2449
		
2450
		[Enum.HumanoidStateType.Jumping] = function()
2451
			if activeState == Enum.HumanoidStateType.Jumping then
2452
				return
2453
			end		
2454
			stopPlayingLoopedSoundsExcept()
2455
			local sound = Sounds[SFX.Jumping]
2456
			Util.Play(sound)
2457
		end;
2458
		
2459
		[Enum.HumanoidStateType.GettingUp] = function()
2460
			stopPlayingLoopedSoundsExcept()
2461
			local sound = Sounds[SFX.GettingUp]
2462
			Util.Play(sound)
2463
		end;
2464
		
2465
		[Enum.HumanoidStateType.Freefall] = function()
2466
			if activeState == Enum.HumanoidStateType.Freefall then
2467
				return
2468
			end
2469
			local sound = Sounds[SFX.FreeFalling]
2470
			sound.Volume = 0
2471
			stopPlayingLoopedSoundsExcept()
2472
		end;
2473
		
2474
		[Enum.HumanoidStateType.FallingDown] = function()
2475
			stopPlayingLoopedSoundsExcept()
2476
		end;
2477
		
2478
		[Enum.HumanoidStateType.Landed] = function()
2479
			stopPlayingLoopedSoundsExcept()
2480
			if Util.VerticalSpeed(Head) > 75 then
2481
				local landingSound = Sounds[SFX.Landing]
2482
				landingSound.Volume = Util.Clamp(
2483
					Util.YForLineGivenXAndTwoPts(
2484
						Util.VerticalSpeed(Head), 
2485
						50, 0, 
2486
						100, 1),
2487
					0,1)
2488
				Util.Play(landingSound)			
2489
			end
2490
		end
2491
	}
2492
	
2493
	-- Handle state event fired or OnChange fired
2494
	function stateUpdated(state)
2495
		if stateUpdateHandler[state] ~= nil then
2496
			stateUpdateHandler[state]()
2497
		end
2498
		activeState = state
2499
	end
2500
	
2501
	Humanoid.Died:connect(			function() stateUpdated(Enum.HumanoidStateType.Dead) 			end)
2502
	Humanoid.Running:connect(		function() stateUpdated(Enum.HumanoidStateType.Running) 		end)
2503
	Humanoid.Swimming:connect(		function() stateUpdated(Enum.HumanoidStateType.Swimming) 		end)
2504
	Humanoid.Climbing:connect(		function() stateUpdated(Enum.HumanoidStateType.Climbing) 		end)
2505
	Humanoid.Jumping:connect(		function() stateUpdated(Enum.HumanoidStateType.Jumping) 		end)
2506
	Humanoid.GettingUp:connect(		function() stateUpdated(Enum.HumanoidStateType.GettingUp) 		end)
2507
	Humanoid.FreeFalling:connect(		function() stateUpdated(Enum.HumanoidStateType.Freefall) 		end)
2508
	Humanoid.FallingDown:connect(		function() stateUpdated(Enum.HumanoidStateType.FallingDown) 	end)
2509
	
2510
	-- required for proper handling of Landed event
2511
	Humanoid.StateChanged:connect(function(old, new)
2512
		stateUpdated(new)
2513
	end)
2514
	
2515
	
2516
	function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
2517
		local stepScale = stepDeltaSeconds / tickSpeedSeconds
2518
		do
2519
			local sound = Sounds[SFX.FreeFalling]
2520
			if activeState == Enum.HumanoidStateType.Freefall then
2521
				if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
2522
					Util.Resume(sound)
2523
					
2524
					--Volume takes 1.1 seconds to go from volume 0 to 1
2525
					local ANIMATION_LENGTH_SECONDS = 1.1
2526
					
2527
					local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS									
2528
					sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
2529
				else
2530
					sound.Volume = 0
2531
				end			
2532
			else
2533
				Util.Pause(sound)
2534
			end
2535
		end
2536
		
2537
		do
2538
			local sound = Sounds[SFX.Running]
2539
			if activeState == Enum.HumanoidStateType.Running then
2540
				if Util.HorizontalSpeed(Head) < 0.5 then
2541
					Util.Pause(sound)
2542
				end
2543
			end
2544
		end		
2545
	end
2546
	
2547
	local lastTick = tick()
2548
	local TICK_SPEED_SECONDS = 0.25
2549
	while true do
2550
		onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
2551
		lastTick = tick()
2552
		wait(TICK_SPEED_SECONDS)
2553
	end
2554
end
2555
2556
end))
2557
Script83.Name = "Animate"
2558
Script83.Parent = Model0
2559
table.insert(cors,sandbox(Script83,function()
2560
function   waitForChild(parent, childName)
2561
	local child = parent:findFirstChild(childName)
2562
	if child then return child end
2563
	while true do
2564
		child = parent.ChildAdded:wait()
2565
		if child.Name==childName then return child end
2566
	end
2567
end
2568
2569
local Figure = script.Parent
2570
local Humanoid = waitForChild(Figure, "NPC")
2571
local pose = "Standing"
2572
2573
local currentAnim = ""
2574
local currentAnimInstance = nil
2575
local currentAnimTrack = nil
2576
local currentAnimKeyframeHandler = nil
2577
local currentAnimSpeed = 0.1
2578
local animTable = {}
2579
local animNames = { 
2580
	idle = 	{	
2581
				{ id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
2582
				{ id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
2583
				{ id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
2584
			},
2585
	walk = 	{ 	
2586
				{ id = "http://www.roblox.com/asset/?id=507777826", weight = 10 } 
2587
			}, 
2588
	run = 	{
2589
				{ id = "http://www.roblox.com/asset/?id=507767714", weight = 10 } 
2590
			}, 
2591
	swim = 	{
2592
				{ id = "http://www.roblox.com/asset/?id=507784897", weight = 10 } 
2593
			}, 
2594
	swimidle = 	{
2595
				{ id = "http://www.roblox.com/asset/?id=507785072", weight = 10 } 
2596
			}, 
2597
	jump = 	{
2598
				{ id = "http://www.roblox.com/asset/?id=507765000", weight = 10 } 
2599
			}, 
2600
	fall = 	{
2601
				{ id = "http://www.roblox.com/asset/?id=507767968", weight = 10 } 
2602
			}, 
2603
	climb = {
2604
				{ id = "http://www.roblox.com/asset/?id=507765644", weight = 10 } 
2605
			}, 
2606
	sit = 	{
2607
				{ id = "http://www.roblox.com/asset/?id=507768133", weight = 10 } 
2608
			},	
2609
	toolnone = {
2610
				{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } 
2611
			},
2612
	toolslash = {
2613
				{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } 
2614
--				{ id = "slash.xml", weight = 10 } 
2615
			},
2616
	toollunge = {
2617
				{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 } 
2618
			},
2619
	wave = {
2620
				{ id = "http://www.roblox.com/asset/?id=507770239", weight = 10 } 
2621
			},
2622
	point = {
2623
				{ id = "http://www.roblox.com/asset/?id=507770453", weight = 10 } 
2624
			},
2625
	dance = {
2626
				{ id = "http://www.roblox.com/asset/?id=507771019", weight = 10 }, 
2627
				{ id = "http://www.roblox.com/asset/?id=507771955", weight = 10 }, 
2628
				{ id = "http://www.roblox.com/asset/?id=507772104", weight = 10 } 
2629
			},
2630
	dance2 = {
2631
				{ id = "http://www.roblox.com/asset/?id=507776043", weight = 10 }, 
2632
				{ id = "http://www.roblox.com/asset/?id=507776720", weight = 10 }, 
2633
				{ id = "http://www.roblox.com/asset/?id=507776879", weight = 10 } 
2634
			},
2635
	dance3 = {
2636
				{ id = "http://www.roblox.com/asset/?id=507777268", weight = 10 }, 
2637
				{ id = "http://www.roblox.com/asset/?id=507777451", weight = 10 }, 
2638
				{ id = "http://www.roblox.com/asset/?id=507777623", weight = 10 } 
2639
			},
2640
	laugh = {
2641
				{ id = "http://www.roblox.com/asset/?id=507770818", weight = 10 } 
2642
			},
2643
	cheer = {
2644
				{ id = "http://www.roblox.com/asset/?id=507770677", weight = 10 } 
2645
			},
2646
}
2647
2648
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
2649
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
2650
2651
math.randomseed(tick())
2652
2653
function configureAnimationSet(name, fileList)
2654
	if (animTable[name] ~= nil) then
2655
		for _, connection in pairs(animTable[name].connections) do
2656
			connection:disconnect()
2657
		end
2658
	end
2659
	animTable[name] = {}
2660
	animTable[name].count = 0
2661
	animTable[name].totalWeight = 0	
2662
	animTable[name].connections = {}
2663
2664
	-- check for config values
2665
	local config = script:FindFirstChild(name)
2666
	if (config ~= nil) then
2667
--		print("Loading anims " .. name)
2668
		table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
2669
		table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
2670
		local idx = 1
2671
		for _, childPart in pairs(config:GetChildren()) do
2672
			if (childPart:IsA("Animation")) then
2673
				table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
2674
				animTable[name][idx] = {}
2675
				animTable[name][idx].anim = childPart
2676
				local weightObject = childPart:FindFirstChild("Weight")
2677
				if (weightObject == nil) then
2678
					animTable[name][idx].weight = 1
2679
				else
2680
					animTable[name][idx].weight = weightObject.Value
2681
				end
2682
				animTable[name].count = animTable[name].count + 1
2683
				animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
2684
--				print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
2685
				idx = idx + 1
2686
			end
2687
		end
2688
	end
2689
2690
	-- fallback to defaults
2691
	if (animTable[name].count <= 0) then
2692
		for idx, anim in pairs(fileList) do
2693
			animTable[name][idx] = {}
2694
			animTable[name][idx].anim = Instance.new("Animation")
2695
			animTable[name][idx].anim.Name = name
2696
			animTable[name][idx].anim.AnimationId = anim.id
2697
			animTable[name][idx].weight = anim.weight
2698
			animTable[name].count = animTable[name].count + 1
2699
			animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
2700
--			print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
2701
		end
2702
	end
2703
end
2704
2705
-- Setup animation objects
2706
function scriptChildModified(child)
2707
	local fileList = animNames[child.Name]
2708
	if (fileList ~= nil) then
2709
		configureAnimationSet(child.Name, fileList)
2710
	end	
2711
end
2712
2713
script.ChildAdded:connect(scriptChildModified)
2714
script.ChildRemoved:connect(scriptChildModified)
2715
2716
2717
for name, fileList in pairs(animNames) do 
2718
	configureAnimationSet(name, fileList)
2719
end	
2720
2721
-- ANIMATION
2722
2723
-- declarations
2724
local toolAnim = "None"
2725
local toolAnimTime = 0
2726
2727
local jumpAnimTime = 3
2728
local jumpAnimDuration = 0.31
2729
2730
local toolTransitionTime = 0.1
2731
local fallTransitionTime = 0.2
2732
2733
-- functions
2734
2735
function stopAllAnimations()
2736
	local oldAnim = currentAnim
2737
2738
	-- return to idle if finishing an emote
2739
	if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
2740
		oldAnim = "idle"
2741
	end
2742
2743
	currentAnim = ""
2744
	currentAnimInstance = nil
2745
	if (currentAnimKeyframeHandler ~= nil) then
2746
		currentAnimKeyframeHandler:disconnect()
2747
	end
2748
2749
	if (currentAnimTrack ~= nil) then
2750
		currentAnimTrack:Stop()
2751
		currentAnimTrack:Destroy()
2752
		currentAnimTrack = nil
2753
	end
2754
	return oldAnim
2755
end
2756
2757
function setAnimationSpeed(speed)
2758
	if speed ~= currentAnimSpeed then
2759
		currentAnimSpeed = speed
2760
		currentAnimTrack:AdjustSpeed(0.8)
2761
	end
2762
end
2763
2764
function keyFrameReachedFunc(frameName)
2765
	if (frameName == "End") then
2766
--		print("Keyframe : ".. frameName)
2767
2768
		local repeatAnim = currentAnim
2769
		-- return to idle if finishing an emote
2770
		if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
2771
			repeatAnim = "idle"
2772
		end
2773
		
2774
		local animSpeed = currentAnimSpeed
2775
		playAnimation(repeatAnim, 0.15, Humanoid)
2776
		setAnimationSpeed(0.8)
2777
	end
2778
end
2779
2780
-- Preload animations
2781
function playAnimation(animName, transitionTime, humanoid) 
2782
		
2783
	local roll = math.random(1, animTable[animName].totalWeight) 
2784
	local origRoll = roll
2785
	local idx = 1
2786
	while (roll > animTable[animName][idx].weight) do
2787
		roll = roll - animTable[animName][idx].weight
2788
		idx = idx + 1
2789
	end
2790
	
2791
--	print(animName .. " " .. idx .. " [" .. origRoll .. "]")
2792
	
2793
	local anim = animTable[animName][idx].anim
2794
2795
	-- switch animation		
2796
	if (anim ~= currentAnimInstance) then
2797
		
2798
		if (currentAnimTrack ~= nil) then
2799
			currentAnimTrack:Stop(transitionTime)
2800
			currentAnimTrack:Destroy()
2801
		end
2802
2803
		currentAnimSpeed = 0.5
2804
	
2805
		-- load it to the humanoid; get AnimationTrack
2806
		currentAnimTrack = humanoid:LoadAnimation(anim)
2807
		 
2808
		-- play the animation
2809
		currentAnimTrack:Play(transitionTime)
2810
		currentAnim = animName
2811
		currentAnimInstance = anim
2812
2813
		-- set up keyframe name triggers
2814
		if (currentAnimKeyframeHandler ~= nil) then
2815
			currentAnimKeyframeHandler:disconnect()
2816
		end
2817
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
2818
		
2819
	end
2820
2821
end
2822
2823
-------------------------------------------------------------------------------------------
2824
-------------------------------------------------------------------------------------------
2825
2826
local toolAnimName = ""
2827
local toolAnimTrack = nil
2828
local toolAnimInstance = nil
2829
local currentToolAnimKeyframeHandler = nil
2830
2831
function toolKeyFrameReachedFunc(frameName)
2832
	if (frameName == "End") then
2833
--		print("Keyframe : ".. frameName)	
2834
		playToolAnimation(toolAnimName, 0.0, Humanoid)
2835
	end
2836
end
2837
2838
2839
function playToolAnimation(animName, transitionTime, humanoid)	 
2840
		
2841
		local roll = math.random(1, animTable[animName].totalWeight) 
2842
		local origRoll = roll
2843
		local idx = 1
2844
		while (roll > animTable[animName][idx].weight) do
2845
			roll = roll - animTable[animName][idx].weight
2846
			idx = idx + 1
2847
		end
2848
--		print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
2849
		local anim = animTable[animName][idx].anim
2850
2851
		if (toolAnimInstance ~= anim) then
2852
			
2853
			if (toolAnimTrack ~= nil) then
2854
				toolAnimTrack:Stop()
2855
				toolAnimTrack:Destroy()
2856
				transitionTime = 0
2857
			end
2858
					
2859
			-- load it to the humanoid; get AnimationTrack
2860
			toolAnimTrack = humanoid:LoadAnimation(anim)
2861
			 
2862
			-- play the animation
2863
			toolAnimTrack:Play(transitionTime)
2864
			toolAnimName = animName
2865
			toolAnimInstance = anim
2866
2867
			currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
2868
		end
2869
end
2870
2871
function stopToolAnimations()
2872
	local oldAnim = toolAnimName
2873
2874
	if (currentToolAnimKeyframeHandler ~= nil) then
2875
		currentToolAnimKeyframeHandler:disconnect()
2876
	end
2877
2878
	toolAnimName = ""
2879
	toolAnimInstance = nil
2880
	if (toolAnimTrack ~= nil) then
2881
		toolAnimTrack:Stop()
2882
		toolAnimTrack:Destroy()
2883
		toolAnimTrack = nil
2884
	end
2885
2886
2887
	return oldAnim
2888
end
2889
2890
-------------------------------------------------------------------------------------------
2891
-------------------------------------------------------------------------------------------
2892
2893
2894
function onRunning(speed)
2895
	if speed > 0.01 then
2896
		local scale = 15.0
2897
		playAnimation("walk", 0.1, Humanoid)
2898
		setAnimationSpeed(speed / scale)
2899
		pose = "Running"
2900
	else
2901
		playAnimation("idle", 0.1, Humanoid)
2902
		pose = "Standing"
2903
	end
2904
end
2905
2906
function onDied()
2907
	pose = "Dead"
2908
end
2909
2910
function onJumping()
2911
	playAnimation("jump", 0.1, Humanoid)
2912
	jumpAnimTime = jumpAnimDuration
2913
	pose = "Jumping"
2914
end
2915
2916
function onClimbing(speed)
2917
	local scale = 5.0
2918
	playAnimation("climb", 0.1, Humanoid)
2919
	setAnimationSpeed(speed / scale)
2920
	pose = "Climbing"
2921
end
2922
2923
function onGettingUp()
2924
	pose = "GettingUp"
2925
end
2926
2927
function onFreeFall()
2928
	if (jumpAnimTime <= 0) then
2929
		playAnimation("fall", fallTransitionTime, Humanoid)
2930
	end
2931
	pose = "FreeFall"
2932
end
2933
2934
function onFallingDown()
2935
	pose = "FallingDown"
2936
end
2937
2938
function onSeated()
2939
	pose = "Seated"
2940
end
2941
2942
function onPlatformStanding()
2943
	pose = "PlatformStanding"
2944
end
2945
2946
function onSwimming(speed)
2947
	if speed > 1.00 then
2948
		local scale = 10.0
2949
		playAnimation("swim", 0.4, Humanoid)
2950
		setAnimationSpeed(speed / scale)
2951
		pose = "Swimming"
2952
	else
2953
		playAnimation("swimidle", 0.4, Humanoid)
2954
		pose = "Standing"
2955
	end
2956
end
2957
2958
function getTool()	
2959
	for _, kid in ipairs(Figure:GetChildren()) do
2960
		if kid.className == "Tool" then return kid end
2961
	end
2962
	return nil
2963
end
2964
2965
function getToolAnim(tool)
2966
	for _, c in ipairs(tool:GetChildren()) do
2967
		if c.Name == "toolanim" and c.className == "StringValue" then
2968
			return c
2969
		end
2970
	end
2971
	return nil
2972
end
2973
2974
function animateTool()
2975
	
2976
	if (toolAnim == "None") then
2977
		playToolAnimation("toolnone", toolTransitionTime, Humanoid)
2978
		return
2979
	end
2980
2981
	if (toolAnim == "Slash") then
2982
		playToolAnimation("toolslash", 0, Humanoid)
2983
		return
2984
	end
2985
2986
	if (toolAnim == "Lunge") then
2987
		playToolAnimation("toollunge", 0, Humanoid)
2988
		return
2989
	end
2990
end
2991
2992
function moveSit()
2993
	RightShoulder.MaxVelocity = 0.15
2994
	LeftShoulder.MaxVelocity = 0.15
2995
	RightShoulder:SetDesiredAngle(3.14 /2)
2996
	LeftShoulder:SetDesiredAngle(-3.14 /2)
2997
	RightHip:SetDesiredAngle(3.14 /2)
2998
	LeftHip:SetDesiredAngle(-3.14 /2)
2999
end
3000
3001
local lastTick = 0
3002
3003
function move(time)
3004
	local amplitude = 1
3005
	local frequency = 1
3006
  	local deltaTime = time - lastTick
3007
  	lastTick = time
3008
3009
	local climbFudge = 0
3010
	local setAngles = false
3011
3012
  	if (jumpAnimTime > 0) then
3013
  		jumpAnimTime = jumpAnimTime - deltaTime
3014
  	end
3015
3016
	if (pose == "FreeFall" and jumpAnimTime <= 0) then
3017
		playAnimation("fall", fallTransitionTime, Humanoid)
3018
	elseif (pose == "Seated") then
3019
		playAnimation("sit", 0.5, Humanoid)
3020
		return
3021
	elseif (pose == "Running") then
3022
		playAnimation("walk", 0.1, Humanoid)
3023
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
3024
		stopAllAnimations()
3025
		amplitude = 0.1
3026
		frequency = 1
3027
		setAngles = true
3028
	end
3029
3030
	-- Tool Animation handling
3031
	local tool = getTool()
3032
	if tool then
3033
	
3034
		animStringValueObject = getToolAnim(tool)
3035
3036
		if animStringValueObject then
3037
			toolAnim = animStringValueObject.Value
3038
			-- message recieved, delete StringValue
3039
			animStringValueObject.Parent = nil
3040
			toolAnimTime = time + .3
3041
		end
3042
3043
		if time > toolAnimTime then
3044
			toolAnimTime = 0
3045
			toolAnim = "None"
3046
		end
3047
3048
		animateTool()		
3049
	else
3050
		stopToolAnimations()
3051
		toolAnim = "None"
3052
		toolAnimInstance = nil
3053
		toolAnimTime = 0
3054
	end
3055
end
3056
3057
-- connect events
3058
Humanoid.Died:connect(onDied)
3059
Humanoid.Running:connect(onRunning)
3060
Humanoid.Jumping:connect(onJumping)
3061
Humanoid.Climbing:connect(onClimbing)
3062
Humanoid.GettingUp:connect(onGettingUp)
3063
Humanoid.FreeFalling:connect(onFreeFall)
3064
Humanoid.FallingDown:connect(onFallingDown)
3065
Humanoid.Seated:connect(onSeated)
3066
Humanoid.PlatformStanding:connect(onPlatformStanding)
3067
Humanoid.Swimming:connect(onSwimming)
3068
3069
-- setup emote chat hook
3070
script.msg.Changed:connect(function(msg)
3071
	script.msg.Value = ""
3072
	local emote = ""
3073
	if (string.sub(msg, 1, 3) == "/e ") then
3074
		emote = string.sub(msg, 4)
3075
	elseif (string.sub(msg, 1, 7) == "/emote ") then
3076
		emote = string.sub(msg, 8)
3077
	end
3078
	
3079
	if (pose == "Standing" and emoteNames[emote] ~= nil) then
3080
		playAnimation(emote, 0.1, Humanoid)
3081
	end
3082
--	print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
3083
end)
3084
3085
3086
-- main program
3087
3088
local runService = game:service("RunService");
3089
3090
-- print("bottom")
3091
3092
-- initialize to idle
3093
playAnimation("idle", 0.1, Humanoid)
3094
pose = "Standing"
3095
3096
while Figure.Parent~=nil do
3097
	local _, time = wait(0.1)
3098
	move(time)
3099
end
3100
3101
3102
3103
end))
3104
StringValue84.Name = "cheer"
3105
StringValue84.Parent = Script83
3106
Animation85.Name = "CheerAnim"
3107
Animation85.Parent = StringValue84
3108
Animation85.AnimationId = "http://www.roblox.com/asset/?id=507770677"
3109
StringValue86.Name = "climb"
3110
StringValue86.Parent = Script83
3111
Animation87.Name = "ClimbAnim"
3112
Animation87.Parent = StringValue86
3113
Animation87.AnimationId = "http://www.roblox.com/asset/?id=742636889"
3114
StringValue88.Name = "dance"
3115
StringValue88.Parent = Script83
3116
Animation89.Name = "Animation1"
3117
Animation89.Parent = StringValue88
3118
Animation89.AnimationId = "http://www.roblox.com/asset/?id=507771019"
3119
NumberValue90.Name = "Weight"
3120
NumberValue90.Parent = Animation89
3121
NumberValue90.Value = 10
3122
Animation91.Name = "Animation2"
3123
Animation91.Parent = StringValue88
3124
Animation91.AnimationId = "http://www.roblox.com/asset/?id=507771955"
3125
NumberValue92.Name = "Weight"
3126
NumberValue92.Parent = Animation91
3127
NumberValue92.Value = 10
3128
Animation93.Name = "Animation3"
3129
Animation93.Parent = StringValue88
3130
Animation93.AnimationId = "http://www.roblox.com/asset/?id=507772104"
3131
NumberValue94.Name = "Weight"
3132
NumberValue94.Parent = Animation93
3133
NumberValue94.Value = 10
3134
StringValue95.Name = "dance2"
3135
StringValue95.Parent = Script83
3136
Animation96.Name = "Animation1"
3137
Animation96.Parent = StringValue95
3138
Animation96.AnimationId = "http://www.roblox.com/asset/?id=507776043"
3139
NumberValue97.Name = "Weight"
3140
NumberValue97.Parent = Animation96
3141
NumberValue97.Value = 10
3142
Animation98.Name = "Animation2"
3143
Animation98.Parent = StringValue95
3144
Animation98.AnimationId = "http://www.roblox.com/asset/?id=507776720"
3145
NumberValue99.Name = "Weight"
3146
NumberValue99.Parent = Animation98
3147
NumberValue99.Value = 10
3148
Animation100.Name = "Animation3"
3149
Animation100.Parent = StringValue95
3150
Animation100.AnimationId = "http://www.roblox.com/asset/?id=507776879"
3151
NumberValue101.Name = "Weight"
3152
NumberValue101.Parent = Animation100
3153
NumberValue101.Value = 10
3154
StringValue102.Name = "dance3"
3155
StringValue102.Parent = Script83
3156
Animation103.Name = "Animation1"
3157
Animation103.Parent = StringValue102
3158
Animation103.AnimationId = "http://www.roblox.com/asset/?id=507777268"
3159
NumberValue104.Name = "Weight"
3160
NumberValue104.Parent = Animation103
3161
NumberValue104.Value = 10
3162
Animation105.Name = "Animation2"
3163
Animation105.Parent = StringValue102
3164
Animation105.AnimationId = "http://www.roblox.com/asset/?id=507777451"
3165
NumberValue106.Name = "Weight"
3166
NumberValue106.Parent = Animation105
3167
NumberValue106.Value = 10
3168
Animation107.Name = "Animation3"
3169
Animation107.Parent = StringValue102
3170
Animation107.AnimationId = "http://www.roblox.com/asset/?id=507777623"
3171
NumberValue108.Name = "Weight"
3172
NumberValue108.Parent = Animation107
3173
NumberValue108.Value = 10
3174
StringValue109.Name = "fall"
3175
StringValue109.Parent = Script83
3176
Animation110.Name = "FallAnim"
3177
Animation110.Parent = StringValue109
3178
Animation110.AnimationId = "http://www.roblox.com/asset/?id=742637151"
3179
StringValue111.Name = "idle"
3180
StringValue111.Parent = Script83
3181
Animation112.Name = "Animation1"
3182
Animation112.Parent = StringValue111
3183
Animation112.AnimationId = "http://www.roblox.com/asset/?id=742637544"
3184
NumberValue113.Name = "Weight"
3185
NumberValue113.Parent = Animation112
3186
NumberValue113.Value = 9
3187
Animation114.Name = "Animation2"
3188
Animation114.Parent = StringValue111
3189
Animation114.AnimationId = "http://www.roblox.com/asset/?id=742638445"
3190
NumberValue115.Name = "Weight"
3191
NumberValue115.Parent = Animation114
3192
NumberValue115.Value = 1
3193
StringValue116.Name = "jump"
3194
StringValue116.Parent = Script83
3195
Animation117.Name = "!ID!"
3196
Animation117.Parent = StringValue116
3197
Animation117.AnimationId = "http://www.roblox.com/asset/?id=742637942"
3198
StringValue118.Name = "laugh"
3199
StringValue118.Parent = Script83
3200
Animation119.Name = "LaughAnim"
3201
Animation119.Parent = StringValue118
3202
Animation119.AnimationId = "http://www.roblox.com/asset/?id=507770818"
3203
StringValue120.Name = "point"
3204
StringValue120.Parent = Script83
3205
Animation121.Name = "PointAnim"
3206
Animation121.Parent = StringValue120
3207
Animation121.AnimationId = "http://www.roblox.com/asset/?id=507770453"
3208
StringValue122.Name = "run"
3209
StringValue122.Parent = Script83
3210
Animation123.Name = "RunAnim"
3211
Animation123.Parent = StringValue122
3212
Animation123.AnimationId = "http://www.roblox.com/asset/?id=742638842"
3213
StringValue124.Name = "sit"
3214
StringValue124.Parent = Script83
3215
Animation125.Name = "SitAnim"
3216
Animation125.Parent = StringValue124
3217
Animation125.AnimationId = "http://www.roblox.com/asset/?id=507768133"
3218
StringValue126.Name = "swim"
3219
StringValue126.Parent = Script83
3220
Animation127.Name = "Swim"
3221
Animation127.Parent = StringValue126
3222
Animation127.AnimationId = "http://www.roblox.com/asset/?id=742639220"
3223
StringValue128.Name = "swimidle"
3224
StringValue128.Parent = Script83
3225
Animation129.Name = "SwimIdle"
3226
Animation129.Parent = StringValue128
3227
Animation129.AnimationId = "http://www.roblox.com/asset/?id=742639812"
3228
StringValue130.Name = "toollunge"
3229
StringValue130.Parent = Script83
3230
Animation131.Name = "ToolLungeAnim"
3231
Animation131.Parent = StringValue130
3232
Animation131.AnimationId = "http://www.roblox.com/asset/?id=507768375"
3233
StringValue132.Name = "toolnone"
3234
StringValue132.Parent = Script83
3235
Animation133.Name = "ToolNoneAnim"
3236
Animation133.Parent = StringValue132
3237
Animation133.AnimationId = "http://www.roblox.com/asset/?id=507768375"
3238
StringValue134.Name = "toolslash"
3239
StringValue134.Parent = Script83
3240
Animation135.Name = "ToolSlashAnim"
3241
Animation135.Parent = StringValue134
3242
Animation135.AnimationId = "http://www.roblox.com/asset/?id=507768375"
3243
StringValue136.Name = "walk"
3244
StringValue136.Parent = Script83
3245
Animation137.Name = "WalkAnim"
3246
Animation137.Parent = StringValue136
3247
Animation137.AnimationId = "http://www.roblox.com/asset/?id=742640026"
3248
StringValue138.Name = "wave"
3249
StringValue138.Parent = Script83
3250
Animation139.Name = "WaveAnim"
3251
Animation139.Parent = StringValue138
3252
Animation139.AnimationId = "http://www.roblox.com/asset/?id=507770239"
3253
Script140.Name = "Health"
3254
Script140.Parent = Model0
3255
table.insert(cors,sandbox(Script140,function()
3256
--Responsible for regening a player's humanoid's health
3257
3258
-- declarations
3259
local Figure = script.Parent
3260
local Head = Figure:WaitForChild("Head")
3261
local Humanoid = Figure:WaitForChild("NPC")
3262
local regening = false
3263
3264
-- regeneration
3265
function regenHealth()
3266
	if regening then return end
3267
	regening = true
3268
	
3269
	while Humanoid.Health < Humanoid.MaxHealth do
3270
		local s = wait(1)
3271
		local health = Humanoid.Health
3272
		if health > 0 and health < Humanoid.MaxHealth then
3273
			local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
3274
			health = health + newHealthDelta
3275
			Humanoid.Health = math.min(health,Humanoid.MaxHealth)
3276
		end
3277
	end
3278
	
3279
	if Humanoid.Health > Humanoid.MaxHealth then
3280
		Humanoid.Health = Humanoid.MaxHealth
3281
	end
3282
	
3283
	regening = false
3284
end
3285
3286
Humanoid.HealthChanged:connect(regenHealth)
3287
  
3288
end))
3289
Script141.Parent = Model0
3290
table.insert(cors,sandbox(Script141,function()
3291
local larm = script.Parent:FindFirstChild("HumanoidRootPart")
3292
local rarm = script.Parent:FindFirstChild("HumanoidRootPart")
3293
3294
function findNearestTorso(pos)
3295
	local list = game.Workspace:children()
3296
	local torso = nil
3297
	local dist = 3500
3298
	local temp = nil
3299
	local human = nil
3300
	local temp2 = nil
3301
	for x = 1, #list do
3302
		temp2 = list[x]
3303
		if (temp2.className == "Model") and (temp2 ~= script.Parent) then
3304
			temp = temp2:findFirstChild("HumanoidRootPart")
3305
			human = temp2:findFirstChild("Humanoid")
3306
			if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
3307
				if (temp.Position - pos).magnitude < dist then
3308
					torso = temp
3309
					dist = (temp.Position - pos).magnitude
3310
				end
3311
			end
3312
		end
3313
	end
3314
	return torso
3315
end
3316
3317
3318
3319
3320
while true do
3321
	wait(math.random(1,5))
3322
	local target = findNearestTorso(script.Parent.HumanoidRootPart.Position)
3323
	if target ~= nil then
3324
		script.Parent.NPC:MoveTo(target.Position, target)
3325
	end
3326
3327
end
3328
3329
end))
3330
Script142.Name = "SprintScriptImporter"
3331
Script142.Parent = Model0
3332
table.insert(cors,sandbox(Script142,function()
3333
function onPlayerEntered(player)
3334
	repeat wait () until player.Character ~= nil
3335
	local s = script.SprintScript:clone()
3336
	s.Parent = player.Character
3337
	s.Disabled = false
3338
	player.CharacterAdded:connect(function (char)
3339
		local s = script.SprintScript:clone()
3340
		s.Parent = char
3341
		s.Disabled = false		
3342
	end)
3343
end
3344
3345
game.Players.PlayerAdded:connect(onPlayerEntered) -- Go to Children and do SprintScript to edit the speed
3346
end))
3347
LocalScript143.Name = "SprintScript"
3348
LocalScript143.Parent = Script142
3349
table.insert(cors,sandbox(LocalScript143,function()
3350
local mouse = game.Players.LocalPlayer:GetMouse()
3351
local running = false
3352
3353
function getTool()	
3354
	for _, kid in ipairs(script.Parent:GetChildren()) do
3355
		if kid.className == "Tool" then return kid end
3356
	end
3357
	return nil
3358
end
3359
3360
3361
mouse.KeyDown:connect(function (key) -- Run function
3362
	key = string.lower(key)
3363
	if string.byte(key) == 48 then
3364
		running = true
3365
		local keyConnection = mouse.KeyUp:connect(function (key)
3366
			if string.byte(key) == 48 then
3367
				running = false
3368
			end
3369
		end)
3370
		for i = 1,5 do
3371
			game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
3372
			wait()
3373
		end
3374
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 40 -- Edit this to what you want while sprinting
3375
		repeat wait () until running == false
3376
		keyConnection:disconnect()
3377
		game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
3378
		for i = 1,5 do
3379
			game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
3380
			wait()
3381
		end
3382
	end
3383
end) -- TheSecondPower
3384
end))
3385
LocalScript143.Disabled = true
3386
Script144.Name = "SuperRun"
3387
Script144.Parent = Model0
3388
table.insert(cors,sandbox(Script144,function()
3389
function makeRun(character)
3390
	local h = character:FindFirstChild("Humanoid")
3391
	if (h~= nil) then
3392
		h.WalkSpeed = 46
3393
	end
3394
3395
end
3396
3397
function onPlayerRespawn(property, player)
3398
	-- need to connect to new humanoid
3399
	
3400
	if property == "Character" and player.Character ~= nil then
3401
		makeRun(player.Character)
3402
	end
3403
end
3404
3405
3406
3407
function onPlayerEntered(newPlayer)
3408
		-- VERY UGLY HACK
3409
		-- Will this leak threads?
3410
		-- Is the problem even what I think it is (player arrived before character)?
3411
		while true do
3412
			if newPlayer.Character ~= nil then break end
3413
			wait(1)
3414
		end
3415
3416
		-- start to listen for new humanoid
3417
		newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
3418
3419
		makeRun(newPlayer.Character)
3420
end
3421
3422
3423
game.Players.ChildAdded:connect(onPlayerEntered)
3424
3425
3426
3427
3428
end))
3429
ObjectValue145.Name = "IsNZ"
3430
ObjectValue145.Parent = Model0
3431
MeshPart146.Name = "LeftFoot"
3432
MeshPart146.Parent = Model0
3433
MeshPart146.CFrame = CFrame.new(-44.8833466, 1.13603067, 39.1852455, 0.00076800026, 3.10000432e-05, -0.999999762, -1.89996717e-05, 1, 3.09854622e-05, 0.999999762, 1.89758666e-05, 0.000768000842)
3434
MeshPart146.Orientation = Vector3.new(0, -89.9599991, 0)
3435
MeshPart146.Position = Vector3.new(-44.8833466, 1.13603067, 39.1852455)
3436
MeshPart146.Rotation = Vector3.new(-2.30999994, -89.9599991, -2.30999994)
3437
MeshPart146.Color = Color3.new(0.294118, 0.592157, 0.294118)
3438
MeshPart146.Size = Vector3.new(6.77673674, 2.27153254, 6.77383852)
3439
MeshPart146.BrickColor = BrickColor.new("Bright green")
3440
MeshPart146.CanCollide = false
3441
MeshPart146.brickColor = BrickColor.new("Bright green")
3442
Vector3Value147.Name = "OriginalSize"
3443
Vector3Value147.Parent = MeshPart146
3444
Vector3Value147.Value = Vector3.new(1.00063133, 0.335407257, 1.00020337)
3445
Script148.Name = "ShieldScript"
3446
Script148.Parent = MeshPart146
3447
table.insert(cors,sandbox(Script148,function()
3448
function ot(hit)
3449
	ch = hit:GetChildren()
3450
	for i = 1, #ch do
3451
		if ch[i].className == "BodyVelocity" then
3452
			ch[i].velocity = ch[i].velocity*-1
3453
		end
3454
	end
3455
	if hit.Parent ~= nil then
3456
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
3457
			if hit.Parent ~= script.Parent.Parent then
3458
				if hit.Parent:FindFirstChild("Torso") ~= nil then
3459
					hit.Parent.Torso.Velocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
3460
					hit.Parent.Torso.RotVelocity = (hit.Parent.Torso.Position - script.Parent.Position)*5
3461
				end
3462
				hit.Parent.Humanoid.PlatformStand = true
3463
			end
3464
		else
3465
			if hit.Parent.className == "Model" or hit.Parent.className == "Hat" then
3466
				if hit.Parent.Parent:FindFirstChild("Humanoid") == nil then
3467
					hit:breakJoints()
3468
					if hit.Anchored == false then
3469
						hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
3470
					end
3471
				end
3472
			else
3473
				hit:breakJoints()
3474
				if hit.Anchored == false then
3475
					hit.Velocity = hit.Velocity*-1 + ((hit.Position - script.Parent.Position)*1000)/hit:GetMass()
3476
				end
3477
			end
3478
		end
3479
	end
3480
	if hit.Parent ~= nil then
3481
		if hit.Parent:FindFirstChild("Humanoid") ~= nil then
3482
			if hit.Parent ~= script.Parent.Parent then
3483
				wait(0.5)
3484
				hit.Parent.Humanoid.PlatformStand = false
3485
			end
3486
		end
3487
	end
3488
end
3489
function remove(child)
3490
	child:Remove()
3491
end
3492
script.Parent.Touched:connect(ot)
3493
script.Parent.ChildAdded:connect(remove)
3494
end))
3495
Script149.Name = "Hurting"
3496
Script149.Parent = MeshPart146
3497
table.insert(cors,sandbox(Script149,function()
3498
function onTouched(hit)
3499
	local humanoid = hit.Parent:findFirstChild("Humanoid")
3500
	if (humanoid ~= nil) then
3501
		humanoid.Health = humanoid.Health - 25
3502
	end
3503
end
3504
3505
script.Parent.Touched:connect(onTouched)
3506
end))
3507
Script150.Name = "qPerfectionWeld"
3508
Script150.Parent = MeshPart146
3509
table.insert(cors,sandbox(Script150,function()
3510
-- Created by Quenty (@Quenty, follow me on twitter).
3511
-- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
3512
-- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
3513
3514
--[[ INSTRUCTIONS
3515
- Place in the model
3516
- Make sure model is anchored
3517
- That's it. It will weld the model and all children. 
3518
3519
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3520
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3521
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3522
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3523
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3524
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3525
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3526
THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED. 
3527
3528
This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes. 
3529
]]
3530
3531
--[[ DOCUMENTATION
3532
- Will work in tools. If ran more than once it will not create more than one weld.  This is especially useful for tools that are dropped and then picked up again.
3533
- Will work in PBS servers
3534
- Will work as long as it starts out with the part anchored
3535
- Stores the relative CFrame as a CFrame value
3536
- Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
3537
- Utilizes a recursive algorith to find all parts in the model
3538
- Will reweld on script reparent if the script is initially parented to a tool.
3539
- Welds as fast as possible
3540
]]
3541
3542
-- qPerfectionWeld.lua
3543
-- Created 10/6/2014
3544
-- Author: Quenty
3545
-- Version 1.0.3
3546
3547
-- Updated 10/14/2014 - Updated to 1.0.1
3548
--- Bug fix with existing ROBLOX welds ? Repro by asimo3089
3549
3550
-- Updated 10/14/2014 - Updated to 1.0.2
3551
--- Fixed bug fix. 
3552
3553
-- Updated 10/14/2014 - Updated to 1.0.3
3554
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
3555
3556
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
3557
3558
3559
local function CallOnChildren(Instance, FunctionToCall)
3560
	-- Calls a function on each of the children of a certain object, using recursion.  
3561
3562
	FunctionToCall(Instance)
3563
3564
	for _, Child in next, Instance:GetChildren() do
3565
		CallOnChildren(Child, FunctionToCall)
3566
	end
3567
end
3568
3569
local function GetNearestParent(Instance, ClassName)
3570
	-- Returns the nearest parent of a certain class, or returns nil
3571
3572
	local Ancestor = Instance
3573
	repeat
3574
		Ancestor = Ancestor.Parent
3575
		if Ancestor == nil then
3576
			return nil
3577
		end
3578
	until Ancestor:IsA(ClassName)
3579
3580
	return Ancestor
3581
end
3582
3583
local function GetBricks(StartInstance)
3584
	local List = {}
3585
3586
	-- if StartInstance:IsA("BasePart") then
3587
	-- 	List[#List+1] = StartInstance
3588
	-- end
3589
3590
	CallOnChildren(StartInstance, function(Item)
3591
		if Item:IsA("BasePart") then
3592
			List[#List+1] = Item;
3593
		end
3594
	end)
3595
3596
	return List
3597
end
3598
3599
local function Modify(Instance, Values)
3600
	-- Modifies an Instance by using a table.  
3601
3602
	assert(type(Values) == "table", "Values is not a table");
3603
3604
	for Index, Value in next, Values do
3605
		if type(Index) == "number" then
3606
			Value.Parent = Instance
3607
		else
3608
			Instance[Index] = Value
3609
		end
3610
	end
3611
	return Instance
3612
end
3613
3614
local function Make(ClassType, Properties)
3615
	-- Using a syntax hack to create a nice way to Make new items.  
3616
3617
	return Modify(Instance.new(ClassType), Properties)
3618
end
3619
3620
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
3621
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
3622
3623
local function HasWheelJoint(Part)
3624
	for _, SurfaceName in pairs(Surfaces) do
3625
		for _, HingSurfaceName in pairs(HingSurfaces) do
3626
			if Part[SurfaceName].Name == HingSurfaceName then
3627
				return true
3628
			end
3629
		end
3630
	end
3631
	
3632
	return false
3633
end
3634
3635
local function ShouldBreakJoints(Part)
3636
	--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
3637
	--  definitely some edge cases. 
3638
3639
	if NEVER_BREAK_JOINTS then
3640
		return false
3641
	end
3642
	
3643
	if HasWheelJoint(Part) then
3644
		return false
3645
	end
3646
	
3647
	local Connected = Part:GetConnectedParts()
3648
	
3649
	if #Connected == 1 then
3650
		return false
3651
	end
3652
	
3653
	for _, Item in pairs(Connected) do
3654
		if HasWheelJoint(Item) then
3655
			return false
3656
		elseif not Item:IsDescendantOf(script.Parent) then
3657
			return false
3658
		end
3659
	end
3660
	
3661
	return true
3662
end
3663
3664
local function WeldTogether(Part0, Part1, JointType, WeldParent)
3665
	--- Weld's 2 parts together
3666
	-- @param Part0 The first part
3667
	-- @param Part1 The second part (Dependent part most of the time).
3668
	-- @param [JointType] The type of joint. Defaults to weld.
3669
	-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
3670
	-- @return The weld created.
3671
3672
	JointType = JointType or "Weld"
3673
	local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
3674
	
3675
	local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
3676
	Modify(NewWeld, {
3677
		Name = "qCFrameWeldThingy";
3678
		Part0  = Part0;
3679
		Part1  = Part1;
3680
		C0     = CFrame.new();--Part0.CFrame:inverse();
3681
		C1     = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
3682
		Parent = Part1;
3683
	})
3684
3685
	if not RelativeValue then
3686
		RelativeValue = Make("CFrameValue", {
3687
			Parent     = Part1;
3688
			Name       = "qRelativeCFrameWeldValue";
3689
			Archivable = true;
3690
			Value      = NewWeld.C1;
3691
		})
3692
	end
3693
3694
	return NewWeld
3695
end
3696
3697
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
3698
	-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
3699
	-- @param MainPart The part to weld the model to (can be in the model).
3700
	-- @param [JointType] The type of joint. Defaults to weld. 
3701
	-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
3702
	
3703
	for _, Part in pairs(Parts) do
3704
		if ShouldBreakJoints(Part) then
3705
			Part:BreakJoints()
3706
		end
3707
	end
3708
	
3709
	for _, Part in pairs(Parts) do
3710
		if Part ~= MainPart then
3711
			WeldTogether(MainPart, Part, JointType, MainPart)
3712
		end
3713
	end
3714
3715
	if not DoNotUnanchor then
3716
		for _, Part in pairs(Parts) do
3717
			Part.Anchored = false
3718
		end
3719
		MainPart.Anchored = false
3720
	end
3721
end
3722
3723
local function PerfectionWeld()	
3724
	local Tool = GetNearestParent(script, "Tool")
3725
3726
	local Parts = GetBricks(script.Parent)
3727
	local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
3728
3729
	if PrimaryPart then
3730
		WeldParts(Parts, PrimaryPart, "Weld", false)
3731
	else
3732
		warn("qWeld - Unable to weld part")
3733
	end
3734
	
3735
	return Tool
3736
end
3737
3738
local Tool = PerfectionWeld()
3739
3740
3741
if Tool and script.ClassName == "Script" then
3742
	--- Don't bother with local scripts
3743
3744
	script.Parent.AncestryChanged:connect(function()
3745
		PerfectionWeld()
3746
	end)
3747
end
3748
3749
-- Created by Quenty (@Quenty, follow me on twitter).
3750
3751
end))
3752
Motor6D151.Name = "LeftAnkle"
3753
Motor6D151.Parent = MeshPart146
3754
Motor6D151.C0 = CFrame.new(-0.0259127952, -4.80933714, 0.00206926349, 1, 0, 0, 0, 1, 0, 0, 0, 1)
3755
Motor6D151.C1 = CFrame.new(-0.0610660091, 0.21972087, 0.00120258378, 1, 0, 0, 0, 1, 0, 0, 0, 1)
3756
Motor6D151.Part0 = MeshPart14
3757
Motor6D151.Part1 = MeshPart146
3758
Motor6D151.part1 = MeshPart146
3759
for i,v in pairs(mas:GetChildren()) do
3760
	v.Parent = workspace
3761
	pcall(function() v:MakeJoints() end)
3762
end
3763
mas:Destroy()
3764
for i,v in pairs(cors) do
3765
	spawn(function()
3766
		pcall(v)
3767
	end)
3768
end