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 | - | MeshPart0 = Instance.new("MeshPart") |
19 | + | Model0 = Instance.new("Model") |
20 | - | Camera1 = Instance.new("Camera") |
20 | + | Model1 = Instance.new("Model") |
21 | - | MeshPart0.Name = "Engineer" |
21 | + | Part2 = Instance.new("Part") |
22 | - | MeshPart0.Parent = mas |
22 | + | SpecialMesh3 = Instance.new("SpecialMesh") |
23 | - | MeshPart0.CFrame = CFrame.new(-3.90036297, 4.21672344, 45.7779312, -1, -8.60618529e-05, -1.84622251e-09, -8.60618529e-05, 1, -1.26470695e-07, 1.8571068e-09, -1.26470695e-07, -1) |
23 | + | Dialog4 = Instance.new("Dialog") |
24 | - | MeshPart0.Orientation = Vector3.new(0, -180, 0) |
24 | + | DialogChoice5 = Instance.new("DialogChoice") |
25 | - | MeshPart0.Position = Vector3.new(-3.90036297, 4.21672344, 45.7779312) |
25 | + | DialogChoice6 = Instance.new("DialogChoice") |
26 | - | MeshPart0.Rotation = Vector3.new(180, 0, 180) |
26 | + | DialogChoice7 = Instance.new("DialogChoice") |
27 | - | MeshPart0.Color = Color3.new(0.843137, 0.772549, 0.603922) |
27 | + | Decal8 = Instance.new("Decal") |
28 | - | MeshPart0.Size = Vector3.new(0.200000003, 8.43342972, 3.55586553) |
28 | + | Part9 = Instance.new("Part") |
29 | - | MeshPart0.Anchored = true |
29 | + | Decal10 = Instance.new("Decal") |
30 | - | MeshPart0.BrickColor = BrickColor.new("Brick yellow") |
30 | + | Motor6D11 = Instance.new("Motor6D") |
31 | - | MeshPart0.CanCollide = false |
31 | + | Motor6D12 = Instance.new("Motor6D") |
32 | - | MeshPart0.Material = Enum.Material.Wood |
32 | + | Motor6D13 = Instance.new("Motor6D") |
33 | - | MeshPart0.brickColor = BrickColor.new("Brick yellow") |
33 | + | Motor6D14 = Instance.new("Motor6D") |
34 | - | MeshPart0.TextureID = "rbxassetid://444593875" |
34 | + | Motor6D15 = Instance.new("Motor6D") |
35 | - | Camera1.Name = "ThumbnailCamera" |
35 | + | Part16 = Instance.new("Part") |
36 | - | Camera1.Parent = MeshPart0 |
36 | + | Part17 = Instance.new("Part") |
37 | - | Camera1.CFrame = CFrame.new(-444.111755, 58.5061722, -255.737213, 0.0110199573, -0.240515828, -0.970582664, -0, 0.970641673, -0.240530416, 0.999939322, 0.00265063485, 0.0106964288) |
37 | + | Part18 = Instance.new("Part") |
38 | - | Camera1.CoordinateFrame = CFrame.new(-444.111755, 58.5061722, -255.737213, 0.0110199573, -0.240515828, -0.970582664, -0, 0.970641673, -0.240530416, 0.999939322, 0.00265063485, 0.0106964288) |
38 | + | Part19 = Instance.new("Part") |
39 | - | Camera1.Focus = CFrame.new(-442.170593, 58.9872322, -255.758606, 1, 0, 0, 0, 1, 0, 0, 0, 1) |
39 | + | Humanoid20 = Instance.new("Humanoid") |
40 | - | Camera1.focus = CFrame.new(-442.170593, 58.9872322, -255.758606, 1, 0, 0, 0, 1, 0, 0, 0, 1) |
40 | + | Part21 = Instance.new("Part") |
41 | Motor6D22 = Instance.new("Motor6D") | |
42 | Script23 = Instance.new("Script") | |
43 | LocalScript24 = Instance.new("LocalScript") | |
44 | Script25 = Instance.new("Script") | |
45 | BodyColors26 = Instance.new("BodyColors") | |
46 | ShirtGraphic27 = Instance.new("ShirtGraphic") | |
47 | Script28 = Instance.new("Script") | |
48 | Script29 = Instance.new("Script") | |
49 | Script30 = Instance.new("Script") | |
50 | StringValue31 = Instance.new("StringValue") | |
51 | Animation32 = Instance.new("Animation") | |
52 | StringValue33 = Instance.new("StringValue") | |
53 | Animation34 = Instance.new("Animation") | |
54 | StringValue35 = Instance.new("StringValue") | |
55 | Animation36 = Instance.new("Animation") | |
56 | NumberValue37 = Instance.new("NumberValue") | |
57 | Animation38 = Instance.new("Animation") | |
58 | NumberValue39 = Instance.new("NumberValue") | |
59 | StringValue40 = Instance.new("StringValue") | |
60 | Animation41 = Instance.new("Animation") | |
61 | StringValue42 = Instance.new("StringValue") | |
62 | Animation43 = Instance.new("Animation") | |
63 | StringValue44 = Instance.new("StringValue") | |
64 | Animation45 = Instance.new("Animation") | |
65 | StringValue46 = Instance.new("StringValue") | |
66 | Animation47 = Instance.new("Animation") | |
67 | Script48 = Instance.new("Script") | |
68 | Script49 = Instance.new("Script") | |
69 | Model0.Name = "Talking Noob" | |
70 | Model0.Parent = mas | |
71 | Model1.Name = "Noob" | |
72 | Model1.Parent = Model0 | |
73 | Model1.PrimaryPart = Part2 | |
74 | Part2.Name = "Head" | |
75 | Part2.Parent = Model1 | |
76 | Part2.CFrame = CFrame.new(-8.56659603, 4.50001431, 72.4827576, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
77 | Part2.Orientation = Vector3.new(0, 164.610001, 0) | |
78 | Part2.Position = Vector3.new(-8.56659603, 4.50001431, 72.4827576) | |
79 | Part2.Rotation = Vector3.new(-180, 15.3899994, -180) | |
80 | Part2.Color = Color3.new(0.960784, 0.803922, 0.188235) | |
81 | Part2.Size = Vector3.new(2, 1, 1) | |
82 | Part2.BrickColor = BrickColor.new("Bright yellow") | |
83 | Part2.TopSurface = Enum.SurfaceType.Smooth | |
84 | Part2.brickColor = BrickColor.new("Bright yellow") | |
85 | Part2.FormFactor = Enum.FormFactor.Symmetric | |
86 | Part2.formFactor = Enum.FormFactor.Symmetric | |
87 | SpecialMesh3.Parent = Part2 | |
88 | SpecialMesh3.Scale = Vector3.new(1.25, 1.25, 1.25) | |
89 | Dialog4.Parent = Part2 | |
90 | Dialog4.GoodbyeDialog = "Uhh bye." | |
91 | Dialog4.InitialPrompt = "H1" | |
92 | Dialog4.Purpose = Enum.DialogPurpose.Quest | |
93 | Dialog4.Tone = Enum.DialogTone.Friendly | |
94 | DialogChoice5.Parent = Dialog4 | |
95 | DialogChoice5.GoodbyeDialog = "Erm bye" | |
96 | DialogChoice5.ResponseDialog = "W4nn4 b3 fr13nd5" | |
97 | DialogChoice5.UserDialog = "Hi..?" | |
98 | DialogChoice6.Parent = DialogChoice5 | |
99 | DialogChoice6.GoodbyeDialog = "...Bye" | |
100 | DialogChoice6.ResponseDialog = "0M6 1'M R3P0R71N6 U 4ND BU1LD3RM4N 15 MY D4D!!!!!!1111" | |
101 | DialogChoice6.UserDialog = "No" | |
102 | DialogChoice7.Parent = DialogChoice5 | |
103 | DialogChoice7.ResponseDialog = "Y4y!" | |
104 | DialogChoice7.UserDialog = "Sure" | |
105 | Decal8.Parent = Part2 | |
106 | Decal8.Texture = "http://www.roblox.com/asset/?id=149118265" | |
107 | Part9.Name = "Torso" | |
108 | Part9.Parent = Model1 | |
109 | Part9.CFrame = CFrame.new(-8.56659603, 3.00001407, 72.4827576, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
110 | Part9.Orientation = Vector3.new(0, 164.610001, 0) | |
111 | Part9.Position = Vector3.new(-8.56659603, 3.00001407, 72.4827576) | |
112 | Part9.Rotation = Vector3.new(-180, 15.3899994, -180) | |
113 | Part9.Color = Color3.new(0.0509804, 0.411765, 0.67451) | |
114 | Part9.Size = Vector3.new(2, 2, 1) | |
115 | Part9.BrickColor = BrickColor.new("Bright blue") | |
116 | Part9.LeftParamA = 0 | |
117 | Part9.LeftParamB = 0 | |
118 | Part9.LeftSurface = Enum.SurfaceType.Weld | |
119 | Part9.RightParamA = 0 | |
120 | Part9.RightParamB = 0 | |
121 | Part9.RightSurface = Enum.SurfaceType.Weld | |
122 | Part9.brickColor = BrickColor.new("Bright blue") | |
123 | Part9.FormFactor = Enum.FormFactor.Symmetric | |
124 | Part9.formFactor = Enum.FormFactor.Symmetric | |
125 | Decal10.Name = "roblox" | |
126 | Decal10.Parent = Part9 | |
127 | Decal10.Texture = "http://www.roblox.com/asset/?id=236928940" | |
128 | Motor6D11.Name = "Right Shoulder" | |
129 | Motor6D11.Parent = Part9 | |
130 | Motor6D11.MaxVelocity = 0.10000000149012 | |
131 | Motor6D11.C0 = CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0) | |
132 | Motor6D11.C1 = CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0) | |
133 | Motor6D11.Part0 = Part9 | |
134 | Motor6D11.Part1 = Part17 | |
135 | Motor6D11.part1 = Part17 | |
136 | Motor6D12.Name = "Left Shoulder" | |
137 | Motor6D12.Parent = Part9 | |
138 | Motor6D12.MaxVelocity = 0.10000000149012 | |
139 | Motor6D12.C0 = CFrame.new(-1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
140 | Motor6D12.C1 = CFrame.new(0.5, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
141 | Motor6D12.Part0 = Part9 | |
142 | Motor6D12.Part1 = Part16 | |
143 | Motor6D12.part1 = Part16 | |
144 | Motor6D13.Name = "Right Hip" | |
145 | Motor6D13.Parent = Part9 | |
146 | Motor6D13.MaxVelocity = 0.10000000149012 | |
147 | Motor6D13.C0 = CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0) | |
148 | Motor6D13.C1 = CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0) | |
149 | Motor6D13.Part0 = Part9 | |
150 | Motor6D13.Part1 = Part19 | |
151 | Motor6D13.part1 = Part19 | |
152 | Motor6D14.Name = "Left Hip" | |
153 | Motor6D14.Parent = Part9 | |
154 | Motor6D14.MaxVelocity = 0.10000000149012 | |
155 | Motor6D14.C0 = CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
156 | Motor6D14.C1 = CFrame.new(-0.5, 1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
157 | Motor6D14.Part0 = Part9 | |
158 | Motor6D14.Part1 = Part18 | |
159 | Motor6D14.part1 = Part18 | |
160 | Motor6D15.Name = "Neck" | |
161 | Motor6D15.Parent = Part9 | |
162 | Motor6D15.MaxVelocity = 0.10000000149012 | |
163 | Motor6D15.C0 = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
164 | Motor6D15.C1 = CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
165 | Motor6D15.Part0 = Part9 | |
166 | Motor6D15.Part1 = Part2 | |
167 | Motor6D15.part1 = Part2 | |
168 | Part16.Name = "Left Arm" | |
169 | Part16.Parent = Model1 | |
170 | Part16.CFrame = CFrame.new(-7.12041187, 3.00001407, 72.8809433, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
171 | Part16.Orientation = Vector3.new(0, 164.610001, 0) | |
172 | Part16.Position = Vector3.new(-7.12041187, 3.00001407, 72.8809433) | |
173 | Part16.Rotation = Vector3.new(-180, 15.3899994, -180) | |
174 | Part16.Color = Color3.new(0.960784, 0.803922, 0.188235) | |
175 | Part16.Size = Vector3.new(1, 2, 1) | |
176 | Part16.BrickColor = BrickColor.new("Bright yellow") | |
177 | Part16.CanCollide = false | |
178 | Part16.brickColor = BrickColor.new("Bright yellow") | |
179 | Part16.FormFactor = Enum.FormFactor.Symmetric | |
180 | Part16.formFactor = Enum.FormFactor.Symmetric | |
181 | Part17.Name = "Right Arm" | |
182 | Part17.Parent = Model1 | |
183 | Part17.CFrame = CFrame.new(-10.0127802, 3.00001407, 72.0845718, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
184 | Part17.Orientation = Vector3.new(0, 164.610001, 0) | |
185 | Part17.Position = Vector3.new(-10.0127802, 3.00001407, 72.0845718) | |
186 | Part17.Rotation = Vector3.new(-180, 15.3899994, -180) | |
187 | Part17.Color = Color3.new(0.960784, 0.803922, 0.188235) | |
188 | Part17.Size = Vector3.new(1, 2, 1) | |
189 | Part17.BrickColor = BrickColor.new("Bright yellow") | |
190 | Part17.CanCollide = false | |
191 | Part17.brickColor = BrickColor.new("Bright yellow") | |
192 | Part17.FormFactor = Enum.FormFactor.Symmetric | |
193 | Part17.formFactor = Enum.FormFactor.Symmetric | |
194 | Part18.Name = "Left Leg" | |
195 | Part18.Parent = Model1 | |
196 | Part18.CFrame = CFrame.new(-8.08453465, 1.00001407, 72.6154861, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
197 | Part18.Orientation = Vector3.new(0, 164.610001, 0) | |
198 | Part18.Position = Vector3.new(-8.08453465, 1.00001407, 72.6154861) | |
199 | Part18.Rotation = Vector3.new(-180, 15.3899994, -180) | |
200 | Part18.Color = Color3.new(0.156863, 0.498039, 0.278431) | |
201 | Part18.Size = Vector3.new(1, 2, 1) | |
202 | Part18.BottomSurface = Enum.SurfaceType.Smooth | |
203 | Part18.BrickColor = BrickColor.new("Dark green") | |
204 | Part18.CanCollide = false | |
205 | Part18.brickColor = BrickColor.new("Dark green") | |
206 | Part18.FormFactor = Enum.FormFactor.Symmetric | |
207 | Part18.formFactor = Enum.FormFactor.Symmetric | |
208 | Part19.Name = "Right Leg" | |
209 | Part19.Parent = Model1 | |
210 | Part19.CFrame = CFrame.new(-9.04865742, 1.00001407, 72.350029, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
211 | Part19.Orientation = Vector3.new(0, 164.610001, 0) | |
212 | Part19.Position = Vector3.new(-9.04865742, 1.00001407, 72.350029) | |
213 | Part19.Rotation = Vector3.new(-180, 15.3899994, -180) | |
214 | Part19.Color = Color3.new(0.156863, 0.498039, 0.278431) | |
215 | Part19.Size = Vector3.new(1, 2, 1) | |
216 | Part19.BottomSurface = Enum.SurfaceType.Smooth | |
217 | Part19.BrickColor = BrickColor.new("Dark green") | |
218 | Part19.CanCollide = false | |
219 | Part19.brickColor = BrickColor.new("Dark green") | |
220 | Part19.FormFactor = Enum.FormFactor.Symmetric | |
221 | Part19.formFactor = Enum.FormFactor.Symmetric | |
222 | Humanoid20.Parent = Model1 | |
223 | Humanoid20.LeftLeg = Part18 | |
224 | Humanoid20.RightLeg = Part19 | |
225 | Humanoid20.Torso = Part21 | |
226 | Part21.Name = "HumanoidRootPart" | |
227 | Part21.Parent = Model1 | |
228 | Part21.CFrame = CFrame.new(-8.56659603, 3.00001407, 72.4827576, -0.964122772, 0, 0.265456945, 0, 1, 0, -0.265456945, 0, -0.964122772) | |
229 | Part21.Orientation = Vector3.new(0, 164.610001, 0) | |
230 | Part21.Position = Vector3.new(-8.56659603, 3.00001407, 72.4827576) | |
231 | Part21.Rotation = Vector3.new(-180, 15.3899994, -180) | |
232 | Part21.Color = Color3.new(0.0509804, 0.411765, 0.67451) | |
233 | Part21.Transparency = 1 | |
234 | Part21.Size = Vector3.new(2, 2, 1) | |
235 | Part21.BottomSurface = Enum.SurfaceType.Smooth | |
236 | Part21.BrickColor = BrickColor.new("Bright blue") | |
237 | Part21.CanCollide = false | |
238 | Part21.LeftParamA = 0 | |
239 | Part21.LeftParamB = 0 | |
240 | Part21.RightParamA = 0 | |
241 | Part21.RightParamB = 0 | |
242 | Part21.TopSurface = Enum.SurfaceType.Smooth | |
243 | Part21.brickColor = BrickColor.new("Bright blue") | |
244 | Part21.FormFactor = Enum.FormFactor.Symmetric | |
245 | Part21.formFactor = Enum.FormFactor.Symmetric | |
246 | Motor6D22.Name = "RootJoint" | |
247 | Motor6D22.Parent = Part21 | |
248 | Motor6D22.MaxVelocity = 0.10000000149012 | |
249 | Motor6D22.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
250 | Motor6D22.C1 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0) | |
251 | Motor6D22.Part0 = Part21 | |
252 | Motor6D22.Part1 = Part9 | |
253 | Motor6D22.part1 = Part9 | |
254 | Script23.Name = "Sound" | |
255 | Script23.Parent = Model1 | |
256 | table.insert(cors,sandbox(Script23,function() | |
257 | ---This server script creates the sounds and also exists so that it can be easily copied into an NPC and create sounds for that NPC. | |
258 | --Remove the local script if you copy this into an NPC. | |
259 | --humanoidSoundNewLocal.rbxmx-- | |
260 | ||
261 | function newSound(name, id) | |
262 | local sound = Instance.new("Sound") | |
263 | sound.SoundId = id | |
264 | sound.Name = name | |
265 | sound.archivable = false | |
266 | sound.Parent = script.Parent.Head | |
267 | return sound | |
268 | end | |
269 | ||
270 | -- declarations | |
271 | ||
272 | local sGettingUp = newSound("GettingUp", "rbxasset://sounds/action_get_up.mp3") | |
273 | local sDied = newSound("Died", "rbxasset://sounds/uuhhh.mp3") | |
274 | local sFreeFalling = newSound("FreeFalling", "rbxasset://sounds/action_falling.mp3") | |
275 | local sJumping = newSound("Jumping", "rbxasset://sounds/action_jump.mp3") | |
276 | local sLanding = newSound("Landing", "rbxasset://sounds/action_jump_land.mp3") | |
277 | local sSplash = newSound("Splash", "rbxasset://sounds/impact_water.mp3") | |
278 | local sRunning = newSound("Running", "rbxasset://sounds/action_footsteps_plastic.mp3") | |
279 | sRunning.Looped = true | |
280 | local sSwimming = newSound("Swimming", "rbxasset://sounds/action_swim.mp3") | |
281 | sSwimming.Looped = true | |
282 | local sClimbing = newSound("Climbing", "rbxasset://sounds/action_footsteps_plastic.mp3") | |
283 | sClimbing.Looped = true | |
284 | ||
285 | ||
286 | end)) | |
287 | LocalScript24.Name = "LocalSound" | |
288 | LocalScript24.Parent = Script23 | |
289 | table.insert(cors,sandbox(LocalScript24,function() | |
290 | --This local script will run only for the player whos character it is in. It's changes to the sounds will replicate as they are changes to the character. | |
291 | -- util | |
292 | ||
293 | function waitForChild(parent, childName) | |
294 | local child = parent:findFirstChild(childName) | |
295 | if child then return child end | |
296 | while true do | |
297 | child = parent.ChildAdded:wait() | |
298 | if child.Name==childName then return child end | |
299 | end | |
300 | end | |
301 | ||
302 | ||
303 | -- declarations | |
304 | ||
305 | local Figure = script.Parent.Parent | |
306 | local Head = waitForChild(Figure, "Head") | |
307 | local Humanoid = waitForChild(Figure, "Humanoid") | |
308 | ||
309 | local sGettingUp = waitForChild(Head, "GettingUp") | |
310 | local sDied = waitForChild(Head, "Died") | |
311 | local sFreeFalling = waitForChild(Head, "FreeFalling") | |
312 | local sJumping = waitForChild(Head, "Jumping") | |
313 | local sLanding = waitForChild(Head, "Landing") | |
314 | local sSplash = waitForChild(Head, "Splash") | |
315 | local sRunning = waitForChild(Head, "Running") | |
316 | sRunning.Looped = true | |
317 | local sSwimming = waitForChild(Head, "Swimming") | |
318 | sSwimming.Looped = true | |
319 | local sClimbing =waitForChild(Head, "Climbing") | |
320 | sClimbing.Looped = true | |
321 | ||
322 | local prevState = "None" | |
323 | ||
324 | -- functions | |
325 | ||
326 | function onDied() | |
327 | stopLoopedSounds() | |
328 | sDied:Play() | |
329 | end | |
330 | ||
331 | local fallCount = 0 | |
332 | local fallSpeed = 0 | |
333 | function onStateFall(state, sound) | |
334 | fallCount = fallCount + 1 | |
335 | if state then | |
336 | sound.Volume = 0 | |
337 | sound:Play() | |
338 | Spawn( function() | |
339 | local t = 0 | |
340 | local thisFall = fallCount | |
341 | while t < 1.5 and fallCount == thisFall do | |
342 | local vol = math.max(t - 0.3 , 0) | |
343 | sound.Volume = vol | |
344 | wait(0.1) | |
345 | t = t + 0.1 | |
346 | end | |
347 | end) | |
348 | else | |
349 | sound:Stop() | |
350 | end | |
351 | fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y)) | |
352 | end | |
353 | ||
354 | ||
355 | function onStateNoStop(state, sound) | |
356 | if state then | |
357 | sound:Play() | |
358 | end | |
359 | end | |
360 | ||
361 | ||
362 | function onRunning(speed) | |
363 | sClimbing:Stop() | |
364 | sSwimming:Stop() | |
365 | if (prevState == "FreeFall" and fallSpeed > 0.1) then | |
366 | local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110)) | |
367 | sLanding.Volume = vol | |
368 | sLanding:Play() | |
369 | fallSpeed = 0 | |
370 | end | |
371 | if speed>0.5 then | |
372 | sRunning:Resume() | |
373 | sRunning.Pitch = speed / 8.0 | |
374 | else | |
375 | sRunning:Pause() | |
376 | end | |
377 | prevState = "Run" | |
378 | end | |
379 | ||
380 | function onSwimming(speed) | |
381 | if (prevState ~= "Swim" and speed > 0.1) then | |
382 | local volume = math.min(1.0, speed / 350) | |
383 | sSplash.Volume = volume | |
384 | sSplash:Play() | |
385 | prevState = "Swim" | |
386 | end | |
387 | sClimbing:Stop() | |
388 | sRunning:Stop() | |
389 | sSwimming.Pitch = 1.6 | |
390 | sSwimming:Resume() | |
391 | end | |
392 | ||
393 | function onClimbing(speed) | |
394 | sRunning:Stop() | |
395 | sSwimming:Stop() | |
396 | if speed>0.01 then | |
397 | sClimbing:Resume() | |
398 | sClimbing.Pitch = speed / 5.5 | |
399 | else | |
400 | sClimbing:Pause() | |
401 | end | |
402 | prevState = "Climb" | |
403 | end | |
404 | -- connect up | |
405 | ||
406 | function stopLoopedSounds() | |
407 | sRunning:Stop() | |
408 | sClimbing:Stop() | |
409 | sSwimming:Stop() | |
410 | end | |
411 | ||
412 | Humanoid.Died:connect(onDied) | |
413 | Humanoid.Running:connect(onRunning) | |
414 | Humanoid.Swimming:connect(onSwimming) | |
415 | Humanoid.Climbing:connect(onClimbing) | |
416 | Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end) | |
417 | Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end) | |
418 | Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end) | |
419 | Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end) | |
420 | Humanoid.StateChanged:connect(function(old, new) | |
421 | if not (new.Name == "Dead" or | |
422 | new.Name == "Running" or | |
423 | new.Name == "RunningNoPhysics" or | |
424 | new.Name == "Swimming" or | |
425 | new.Name == "Jumping" or | |
426 | new.Name == "GettingUp" or | |
427 | new.Name == "Freefall" or | |
428 | new.Name == "FallingDown") then | |
429 | stopLoopedSounds() | |
430 | end | |
431 | end) | |
432 | ||
433 | ||
434 | end)) | |
435 | Script25.Name = "Health" | |
436 | Script25.Parent = Model1 | |
437 | table.insert(cors,sandbox(Script25,function() | |
438 | --Responsible for regening a player's humanoid's health | |
439 | ||
440 | -- declarations | |
441 | local Figure = script.Parent | |
442 | local Head = Figure:WaitForChild("Head") | |
443 | local Humanoid = Figure:WaitForChild("Humanoid") | |
444 | local regening = false | |
445 | ||
446 | -- regeneration | |
447 | function regenHealth() | |
448 | if regening then return end | |
449 | regening = true | |
450 | ||
451 | while Humanoid.Health < Humanoid.MaxHealth do | |
452 | local s = wait(1) | |
453 | local health = Humanoid.Health | |
454 | if health > 0 and health < Humanoid.MaxHealth then | |
455 | local newHealthDelta = 0.01 * s * Humanoid.MaxHealth | |
456 | health = health + newHealthDelta | |
457 | Humanoid.Health = math.min(health,Humanoid.MaxHealth) | |
458 | end | |
459 | end | |
460 | ||
461 | if Humanoid.Health > Humanoid.MaxHealth then | |
462 | Humanoid.Health = Humanoid.MaxHealth | |
463 | end | |
464 | ||
465 | regening = false | |
466 | end | |
467 | ||
468 | Humanoid.HealthChanged:connect(regenHealth) | |
469 | ||
470 | end)) | |
471 | BodyColors26.Parent = Model1 | |
472 | BodyColors26.HeadColor = BrickColor.new("Bright yellow") | |
473 | BodyColors26.HeadColor3 = Color3.new(0.960784, 0.803922, 0.188235) | |
474 | BodyColors26.LeftArmColor = BrickColor.new("Bright yellow") | |
475 | BodyColors26.LeftArmColor3 = Color3.new(0.960784, 0.803922, 0.188235) | |
476 | BodyColors26.LeftLegColor = BrickColor.new("Dark green") | |
477 | BodyColors26.LeftLegColor3 = Color3.new(0.156863, 0.498039, 0.278431) | |
478 | BodyColors26.RightArmColor = BrickColor.new("Bright yellow") | |
479 | BodyColors26.RightArmColor3 = Color3.new(0.960784, 0.803922, 0.188235) | |
480 | BodyColors26.RightLegColor = BrickColor.new("Dark green") | |
481 | BodyColors26.RightLegColor3 = Color3.new(0.156863, 0.498039, 0.278431) | |
482 | BodyColors26.TorsoColor = BrickColor.new("Bright blue") | |
483 | BodyColors26.TorsoColor3 = Color3.new(0.0509804, 0.411765, 0.67451) | |
484 | ShirtGraphic27.Parent = Model1 | |
485 | ShirtGraphic27.Graphic = "http://www.roblox.com/asset/?id=236928940" | |
486 | Script28.Name = "RandomChat" | |
487 | Script28.Parent = Model1 | |
488 | table.insert(cors,sandbox(Script28,function() | |
489 | while true do | |
490 | e = (math.random(1, 7)) | |
491 | ||
492 | if e == 1 then | |
493 | game:GetService("Chat"):Chat(script.Parent.Head, "Hi :3", Enum.ChatColor.Blue) | |
494 | wait(2) | |
495 | end | |
496 | ||
497 | if e == 2 then | |
498 | game:GetService("Chat"):Chat(script.Parent.Head, "Wanna be friends?", Enum.ChatColor.Blue) | |
499 | wait(2) | |
500 | end | |
501 | ||
502 | if e == 3 then | |
503 | game:GetService("Chat"):Chat(script.Parent.Head, "BUILDERMAN IS MY DAD", Enum.ChatColor.Blue) | |
504 | wait(2) | |
505 | end | |
506 | if e == 4 then | |
507 | game:GetService("Chat"):Chat(script.Parent.Head, "0M6 1'M R3P0R71NG Y0U!!111!!", Enum.ChatColor.Blue) | |
508 | wait(2) | |
509 | end | |
510 | if e == 5 then | |
511 | game:GetService("Chat"):Chat(script.Parent.Head, "TEH EPIK DUCK IS COMING", Enum.ChatColor.Blue) | |
512 | wait(2) | |
513 | end | |
514 | if e == 6 then | |
515 | game:GetService("Chat"):Chat(script.Parent.Head, "Yes", Enum.ChatColor.Blue) | |
516 | wait(2) | |
517 | if e == 7 then | |
518 | game:GetService("Chat"):Chat(script.Parent.Head, "ALL YOUR BASES ARE BELONG TO ME", Enum.ChatColor.Blue) | |
519 | wait(2) | |
520 | end | |
521 | end | |
522 | end | |
523 | ||
524 | end)) | |
525 | Script29.Name = "Follow" | |
526 | Script29.Parent = Model1 | |
527 | table.insert(cors,sandbox(Script29,function() | |
528 | local larm = script.Parent:FindFirstChild("Left Arm") | |
529 | local rarm = script.Parent:FindFirstChild("Right Arm") | |
530 | ||
531 | function findNearestTorso(pos) | |
532 | local list = game.Workspace:children() | |
533 | local torso = nil | |
534 | local dist = 50 | |
535 | local temp = nil | |
536 | local human = nil | |
537 | local temp2 = nil | |
538 | for x = 1, #list do | |
539 | temp2 = list[x] | |
540 | if (temp2.className == "Model") and (temp2 ~= script.Parent) then | |
541 | temp = temp2:findFirstChild("Torso") | |
542 | human = temp2:findFirstChild("Humanoid") | |
543 | if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then | |
544 | if (temp.Position - pos).magnitude < dist then | |
545 | torso = temp | |
546 | dist = (temp.Position - pos).magnitude | |
547 | end | |
548 | end | |
549 | end | |
550 | end | |
551 | return torso | |
552 | end | |
553 | ||
554 | while true do | |
555 | wait(0.1) | |
556 | local target = findNearestTorso(script.Parent.Torso.Position) | |
557 | if target ~= nil then-- | |
558 | script.Parent.Humanoid:MoveTo(target.Position, target) | |
559 | end | |
560 | end | |
561 | end)) | |
562 | Script30.Name = "Animate" | |
563 | Script30.Parent = Model1 | |
564 | table.insert(cors,sandbox(Script30,function() | |
565 | function waitForChild(parent, childName) | |
566 | local child = parent:findFirstChild(childName) | |
567 | if child then return child end | |
568 | while true do | |
569 | child = parent.ChildAdded:wait() | |
570 | if child.Name==childName then return child end | |
571 | end | |
572 | end | |
573 | ||
574 | local Figure = script.Parent | |
575 | local Torso = waitForChild(Figure, "Torso") | |
576 | local RightShoulder = waitForChild(Torso, "Right Shoulder") | |
577 | local LeftShoulder = waitForChild(Torso, "Left Shoulder") | |
578 | local RightHip = waitForChild(Torso, "Right Hip") | |
579 | local LeftHip = waitForChild(Torso, "Left Hip") | |
580 | local Neck = waitForChild(Torso, "Neck") | |
581 | local Humanoid = waitForChild(Figure, "Humanoid") | |
582 | local pose = "Standing" | |
583 | ||
584 | local currentAnim = "" | |
585 | local currentAnimTrack = nil | |
586 | local currentAnimKeyframeHandler = nil | |
587 | local currentAnimSpeed = 1.0 | |
588 | local animTable = {} | |
589 | local animNames = { | |
590 | idle = { | |
591 | { id = "http://www.roblox.com/asset/?id=125750544", weight = 9 }, | |
592 | { id = "http://www.roblox.com/asset/?id=125750618", weight = 1 } | |
593 | }, | |
594 | walk = { | |
595 | { id = "http://www.roblox.com/asset/?id=125749145", weight = 10 } | |
596 | }, | |
597 | run = { | |
598 | { id = "run.xml", weight = 10 } | |
599 | }, | |
600 | jump = { | |
601 | { id = "http://www.roblox.com/asset/?id=125750702", weight = 10 } | |
602 | }, | |
603 | fall = { | |
604 | { id = "http://www.roblox.com/asset/?id=125750759", weight = 10 } | |
605 | }, | |
606 | climb = { | |
607 | { id = "http://www.roblox.com/asset/?id=125750800", weight = 10 } | |
608 | }, | |
609 | toolnone = { | |
610 | { id = "http://www.roblox.com/asset/?id=125750867", weight = 10 } | |
611 | }, | |
612 | toolslash = { | |
613 | { id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } | |
614 | -- { id = "slash.xml", weight = 10 } | |
615 | }, | |
616 | toollunge = { | |
617 | { id = "http://www.roblox.com/asset/?id=129967478", weight = 10 } | |
618 | }, | |
619 | wave = { | |
620 | { id = "http://www.roblox.com/asset/?id=128777973", weight = 10 } | |
621 | }, | |
622 | point = { | |
623 | { id = "http://www.roblox.com/asset/?id=128853357", weight = 10 } | |
624 | }, | |
625 | dance = { | |
626 | { id = "http://www.roblox.com/asset/?id=130018893", weight = 10 }, | |
627 | { id = "http://www.roblox.com/asset/?id=132546839", weight = 10 }, | |
628 | { id = "http://www.roblox.com/asset/?id=132546884", weight = 10 } | |
629 | }, | |
630 | dance2 = { | |
631 | { id = "http://www.roblox.com/asset/?id=160934142", weight = 10 }, | |
632 | { id = "http://www.roblox.com/asset/?id=160934298", weight = 10 }, | |
633 | { id = "http://www.roblox.com/asset/?id=160934376", weight = 10 } | |
634 | }, | |
635 | dance3 = { | |
636 | { id = "http://www.roblox.com/asset/?id=160934458", weight = 10 }, | |
637 | { id = "http://www.roblox.com/asset/?id=160934530", weight = 10 }, | |
638 | { id = "http://www.roblox.com/asset/?id=160934593", weight = 10 } | |
639 | }, | |
640 | laugh = { | |
641 | { id = "http://www.roblox.com/asset/?id=129423131", weight = 10 } | |
642 | }, | |
643 | cheer = { | |
644 | { id = "http://www.roblox.com/asset/?id=129423030", weight = 10 } | |
645 | }, | |
646 | } | |
647 | ||
648 | -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote | |
649 | local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false} | |
650 | ||
651 | math.randomseed(tick()) | |
652 | ||
653 | function configureAnimationSet(name, fileList) | |
654 | if (animTable[name] ~= nil) then | |
655 | for _, connection in pairs(animTable[name].connections) do | |
656 | connection:disconnect() | |
657 | end | |
658 | end | |
659 | animTable[name] = {} | |
660 | animTable[name].count = 0 | |
661 | animTable[name].totalWeight = 0 | |
662 | animTable[name].connections = {} | |
663 | ||
664 | -- check for config values | |
665 | local config = script:FindFirstChild(name) | |
666 | if (config ~= nil) then | |
667 | -- print("Loading anims " .. name) | |
668 | table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) | |
669 | table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) | |
670 | local idx = 1 | |
671 | for _, childPart in pairs(config:GetChildren()) do | |
672 | if (childPart:IsA("Animation")) then | |
673 | table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) | |
674 | animTable[name][idx] = {} | |
675 | animTable[name][idx].anim = childPart | |
676 | local weightObject = childPart:FindFirstChild("Weight") | |
677 | if (weightObject == nil) then | |
678 | animTable[name][idx].weight = 1 | |
679 | else | |
680 | animTable[name][idx].weight = weightObject.Value | |
681 | end | |
682 | animTable[name].count = animTable[name].count + 1 | |
683 | animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight | |
684 | -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")") | |
685 | idx = idx + 1 | |
686 | end | |
687 | end | |
688 | end | |
689 | ||
690 | -- fallback to defaults | |
691 | if (animTable[name].count <= 0) then | |
692 | for idx, anim in pairs(fileList) do | |
693 | animTable[name][idx] = {} | |
694 | animTable[name][idx].anim = Instance.new("Animation") | |
695 | animTable[name][idx].anim.Name = name | |
696 | animTable[name][idx].anim.AnimationId = anim.id | |
697 | animTable[name][idx].weight = anim.weight | |
698 | animTable[name].count = animTable[name].count + 1 | |
699 | animTable[name].totalWeight = animTable[name].totalWeight + anim.weight | |
700 | -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")") | |
701 | end | |
702 | end | |
703 | end | |
704 | ||
705 | -- Setup animation objects | |
706 | function scriptChildModified(child) | |
707 | local fileList = animNames[child.Name] | |
708 | if (fileList ~= nil) then | |
709 | configureAnimationSet(child.Name, fileList) | |
710 | end | |
711 | end | |
712 | ||
713 | script.ChildAdded:connect(scriptChildModified) | |
714 | script.ChildRemoved:connect(scriptChildModified) | |
715 | ||
716 | ||
717 | for name, fileList in pairs(animNames) do | |
718 | configureAnimationSet(name, fileList) | |
719 | end | |
720 | ||
721 | -- ANIMATION | |
722 | ||
723 | -- declarations | |
724 | local toolAnim = "None" | |
725 | local toolAnimTime = 0 | |
726 | ||
727 | local jumpAnimTime = 0 | |
728 | local jumpAnimDuration = 0.3 | |
729 | ||
730 | local toolTransitionTime = 0.1 | |
731 | local fallTransitionTime = 0.3 | |
732 | local jumpMaxLimbVelocity = 0.75 | |
733 | ||
734 | -- functions | |
735 | ||
736 | function stopAllAnimations() | |
737 | local oldAnim = currentAnim | |
738 | ||
739 | -- return to idle if finishing an emote | |
740 | if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then | |
741 | oldAnim = "idle" | |
742 | end | |
743 | ||
744 | currentAnim = "" | |
745 | if (currentAnimKeyframeHandler ~= nil) then | |
746 | currentAnimKeyframeHandler:disconnect() | |
747 | end | |
748 | ||
749 | if (currentAnimTrack ~= nil) then | |
750 | currentAnimTrack:Stop() | |
751 | currentAnimTrack:Destroy() | |
752 | currentAnimTrack = nil | |
753 | end | |
754 | return oldAnim | |
755 | end | |
756 | ||
757 | function setAnimationSpeed(speed) | |
758 | if speed ~= currentAnimSpeed then | |
759 | currentAnimSpeed = speed | |
760 | currentAnimTrack:AdjustSpeed(currentAnimSpeed) | |
761 | end | |
762 | end | |
763 | ||
764 | function keyFrameReachedFunc(frameName) | |
765 | if (frameName == "End") then | |
766 | -- print("Keyframe : ".. frameName) | |
767 | local repeatAnim = stopAllAnimations() | |
768 | local animSpeed = currentAnimSpeed | |
769 | playAnimation(repeatAnim, 0.0, Humanoid) | |
770 | setAnimationSpeed(animSpeed) | |
771 | end | |
772 | end | |
773 | ||
774 | -- Preload animations | |
775 | function playAnimation(animName, transitionTime, humanoid) | |
776 | local idleFromEmote = (animName == "idle" and emoteNames[currentAnim] ~= nil) | |
777 | if (animName ~= currentAnim and not idleFromEmote) then | |
778 | ||
779 | if (currentAnimTrack ~= nil) then | |
780 | currentAnimTrack:Stop(transitionTime) | |
781 | currentAnimTrack:Destroy() | |
782 | end | |
783 | ||
784 | currentAnimSpeed = 1.0 | |
785 | local roll = math.random(1, animTable[animName].totalWeight) | |
786 | local origRoll = roll | |
787 | local idx = 1 | |
788 | while (roll > animTable[animName][idx].weight) do | |
789 | roll = roll - animTable[animName][idx].weight | |
790 | idx = idx + 1 | |
791 | end | |
792 | -- print(animName .. " " .. idx .. " [" .. origRoll .. "]") | |
793 | local anim = animTable[animName][idx].anim | |
794 | ||
795 | -- load it to the humanoid; get AnimationTrack | |
796 | currentAnimTrack = humanoid:LoadAnimation(anim) | |
797 | ||
798 | -- play the animation | |
799 | currentAnimTrack:Play(transitionTime) | |
800 | currentAnim = animName | |
801 | ||
802 | -- set up keyframe name triggers | |
803 | if (currentAnimKeyframeHandler ~= nil) then | |
804 | currentAnimKeyframeHandler:disconnect() | |
805 | end | |
806 | currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc) | |
807 | end | |
808 | end | |
809 | ||
810 | ------------------------------------------------------------------------------------------- | |
811 | ------------------------------------------------------------------------------------------- | |
812 | ||
813 | local toolAnimName = "" | |
814 | local toolAnimTrack = nil | |
815 | local currentToolAnimKeyframeHandler = nil | |
816 | ||
817 | function toolKeyFrameReachedFunc(frameName) | |
818 | if (frameName == "End") then | |
819 | -- print("Keyframe : ".. frameName) | |
820 | local repeatAnim = stopToolAnimations() | |
821 | playToolAnimation(repeatAnim, 0.0, Humanoid) | |
822 | end | |
823 | end | |
824 | ||
825 | ||
826 | function playToolAnimation(animName, transitionTime, humanoid) | |
827 | if (animName ~= toolAnimName) then | |
828 | ||
829 | if (toolAnimTrack ~= nil) then | |
830 | toolAnimTrack:Stop() | |
831 | toolAnimTrack:Destroy() | |
832 | transitionTime = 0 | |
833 | end | |
834 | ||
835 | local roll = math.random(1, animTable[animName].totalWeight) | |
836 | local origRoll = roll | |
837 | local idx = 1 | |
838 | while (roll > animTable[animName][idx].weight) do | |
839 | roll = roll - animTable[animName][idx].weight | |
840 | idx = idx + 1 | |
841 | end | |
842 | -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]") | |
843 | local anim = animTable[animName][idx].anim | |
844 | ||
845 | -- load it to the humanoid; get AnimationTrack | |
846 | toolAnimTrack = humanoid:LoadAnimation(anim) | |
847 | ||
848 | -- play the animation | |
849 | toolAnimTrack:Play(transitionTime) | |
850 | toolAnimName = animName | |
851 | ||
852 | currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc) | |
853 | end | |
854 | end | |
855 | ||
856 | function stopToolAnimations() | |
857 | local oldAnim = toolAnimName | |
858 | ||
859 | if (currentToolAnimKeyframeHandler ~= nil) then | |
860 | currentToolAnimKeyframeHandler:disconnect() | |
861 | end | |
862 | ||
863 | toolAnimName = "" | |
864 | if (toolAnimTrack ~= nil) then | |
865 | toolAnimTrack:Stop() | |
866 | toolAnimTrack:Destroy() | |
867 | toolAnimTrack = nil | |
868 | end | |
869 | ||
870 | ||
871 | return oldAnim | |
872 | end | |
873 | ||
874 | ------------------------------------------------------------------------------------------- | |
875 | ------------------------------------------------------------------------------------------- | |
876 | ||
877 | ||
878 | function onRunning(speed) | |
879 | if speed>0.01 then | |
880 | playAnimation("walk", 0.1, Humanoid) | |
881 | pose = "Running" | |
882 | else | |
883 | playAnimation("idle", 0.1, Humanoid) | |
884 | pose = "Standing" | |
885 | end | |
886 | end | |
887 | ||
888 | function onDied() | |
889 | pose = "Dead" | |
890 | end | |
891 | ||
892 | function onJumping() | |
893 | playAnimation("jump", 0.1, Humanoid) | |
894 | jumpAnimTime = jumpAnimDuration | |
895 | pose = "Jumping" | |
896 | end | |
897 | ||
898 | function onClimbing(speed) | |
899 | playAnimation("climb", 0.1, Humanoid) | |
900 | setAnimationSpeed(speed / 12.0) | |
901 | pose = "Climbing" | |
902 | end | |
903 | ||
904 | function onGettingUp() | |
905 | pose = "GettingUp" | |
906 | end | |
907 | ||
908 | function onFreeFall() | |
909 | if (jumpAnimTime <= 0) then | |
910 | playAnimation("fall", fallTransitionTime, Humanoid) | |
911 | end | |
912 | pose = "FreeFall" | |
913 | end | |
914 | ||
915 | function onFallingDown() | |
916 | pose = "FallingDown" | |
917 | end | |
918 | ||
919 | function onSeated() | |
920 | pose = "Seated" | |
921 | end | |
922 | ||
923 | function onPlatformStanding() | |
924 | pose = "PlatformStanding" | |
925 | end | |
926 | ||
927 | function onSwimming(speed) | |
928 | if speed>0 then | |
929 | pose = "Running" | |
930 | else | |
931 | pose = "Standing" | |
932 | end | |
933 | end | |
934 | ||
935 | function getTool() | |
936 | for _, kid in ipairs(Figure:GetChildren()) do | |
937 | if kid.className == "Tool" then return kid end | |
938 | end | |
939 | return nil | |
940 | end | |
941 | ||
942 | function getToolAnim(tool) | |
943 | for _, c in ipairs(tool:GetChildren()) do | |
944 | if c.Name == "toolanim" and c.className == "StringValue" then | |
945 | return c | |
946 | end | |
947 | end | |
948 | return nil | |
949 | end | |
950 | ||
951 | function animateTool() | |
952 | ||
953 | if (toolAnim == "None") then | |
954 | playToolAnimation("toolnone", toolTransitionTime, Humanoid) | |
955 | return | |
956 | end | |
957 | ||
958 | if (toolAnim == "Slash") then | |
959 | playToolAnimation("toolslash", 0, Humanoid) | |
960 | return | |
961 | end | |
962 | ||
963 | if (toolAnim == "Lunge") then | |
964 | playToolAnimation("toollunge", 0, Humanoid) | |
965 | return | |
966 | end | |
967 | end | |
968 | ||
969 | function moveSit() | |
970 | RightShoulder.MaxVelocity = 0.15 | |
971 | LeftShoulder.MaxVelocity = 0.15 | |
972 | RightShoulder:SetDesiredAngle(3.14 /2) | |
973 | LeftShoulder:SetDesiredAngle(-3.14 /2) | |
974 | RightHip:SetDesiredAngle(3.14 /2) | |
975 | LeftHip:SetDesiredAngle(-3.14 /2) | |
976 | end | |
977 | ||
978 | local lastTick = 0 | |
979 | ||
980 | function move(time) | |
981 | local amplitude = 1 | |
982 | local frequency = 1 | |
983 | local deltaTime = time - lastTick | |
984 | lastTick = time | |
985 | ||
986 | local climbFudge = 0 | |
987 | local setAngles = false | |
988 | ||
989 | if (jumpAnimTime > 0) then | |
990 | jumpAnimTime = jumpAnimTime - deltaTime | |
991 | end | |
992 | ||
993 | if (pose == "FreeFall" and jumpAnimTime <= 0) then | |
994 | playAnimation("fall", fallTransitionTime, Humanoid) | |
995 | elseif (pose == "Seated") then | |
996 | stopAllAnimations() | |
997 | moveSit() | |
998 | return | |
999 | elseif (pose == "Running") then | |
1000 | playAnimation("walk", 0.1, Humanoid) | |
1001 | elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then | |
1002 | -- print("Wha " .. pose) | |
1003 | amplitude = 0.1 | |
1004 | frequency = 1 | |
1005 | setAngles = true | |
1006 | end | |
1007 | ||
1008 | if (setAngles) then | |
1009 | desiredAngle = amplitude * math.sin(time * frequency) | |
1010 | ||
1011 | RightShoulder:SetDesiredAngle(desiredAngle + climbFudge) | |
1012 | LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge) | |
1013 | RightHip:SetDesiredAngle(-desiredAngle) | |
1014 | LeftHip:SetDesiredAngle(-desiredAngle) | |
1015 | end | |
1016 | ||
1017 | -- Tool Animation handling | |
1018 | local tool = getTool() | |
1019 | if tool then | |
1020 | ||
1021 | animStringValueObject = getToolAnim(tool) | |
1022 | ||
1023 | if animStringValueObject then | |
1024 | toolAnim = animStringValueObject.Value | |
1025 | -- message recieved, delete StringValue | |
1026 | animStringValueObject.Parent = nil | |
1027 | toolAnimTime = time + .3 | |
1028 | end | |
1029 | ||
1030 | if time > toolAnimTime then | |
1031 | toolAnimTime = 0 | |
1032 | toolAnim = "None" | |
1033 | end | |
1034 | ||
1035 | animateTool() | |
1036 | else | |
1037 | stopToolAnimations() | |
1038 | toolAnim = "None" | |
1039 | toolAnimTime = 0 | |
1040 | end | |
1041 | end | |
1042 | ||
1043 | -- connect events | |
1044 | Humanoid.Died:connect(onDied) | |
1045 | Humanoid.Running:connect(onRunning) | |
1046 | Humanoid.Jumping:connect(onJumping) | |
1047 | Humanoid.Climbing:connect(onClimbing) | |
1048 | Humanoid.GettingUp:connect(onGettingUp) | |
1049 | Humanoid.FreeFalling:connect(onFreeFall) | |
1050 | Humanoid.FallingDown:connect(onFallingDown) | |
1051 | Humanoid.Seated:connect(onSeated) | |
1052 | Humanoid.PlatformStanding:connect(onPlatformStanding) | |
1053 | Humanoid.Swimming:connect(onSwimming) | |
1054 | ||
1055 | -- main program | |
1056 | ||
1057 | local runService = game:service("RunService"); | |
1058 | ||
1059 | -- initialize to idle | |
1060 | playAnimation("idle", 0.1, Humanoid) | |
1061 | pose = "Standing" | |
1062 | ||
1063 | while Figure.Parent~=nil do | |
1064 | local _, time = wait(0.1) | |
1065 | move(time) | |
1066 | end | |
1067 | ||
1068 | ||
1069 | ||
1070 | end)) | |
1071 | StringValue31.Name = "climb" | |
1072 | StringValue31.Parent = Script30 | |
1073 | Animation32.Name = "ClimbAnim" | |
1074 | Animation32.Parent = StringValue31 | |
1075 | Animation32.AnimationId = "http://www.roblox.com/asset/?id=125750800" | |
1076 | StringValue33.Name = "fall" | |
1077 | StringValue33.Parent = Script30 | |
1078 | Animation34.Name = "FallAnim" | |
1079 | Animation34.Parent = StringValue33 | |
1080 | Animation34.AnimationId = "http://www.roblox.com/asset/?id=125750759" | |
1081 | StringValue35.Name = "idle" | |
1082 | StringValue35.Parent = Script30 | |
1083 | Animation36.Name = "Animation1" | |
1084 | Animation36.Parent = StringValue35 | |
1085 | Animation36.AnimationId = "http://www.roblox.com/asset/?id=125750544" | |
1086 | NumberValue37.Name = "Weight" | |
1087 | NumberValue37.Parent = Animation36 | |
1088 | NumberValue37.Value = 9 | |
1089 | Animation38.Name = "Animation2" | |
1090 | Animation38.Parent = StringValue35 | |
1091 | Animation38.AnimationId = "http://www.roblox.com/asset/?id=125750618" | |
1092 | NumberValue39.Name = "Weight" | |
1093 | NumberValue39.Parent = Animation38 | |
1094 | NumberValue39.Value = 1 | |
1095 | StringValue40.Name = "jump" | |
1096 | StringValue40.Parent = Script30 | |
1097 | Animation41.Name = "JumpAnim" | |
1098 | Animation41.Parent = StringValue40 | |
1099 | Animation41.AnimationId = "http://www.roblox.com/asset/?id=125750702" | |
1100 | StringValue42.Name = "run" | |
1101 | StringValue42.Parent = Script30 | |
1102 | Animation43.Name = "RunAnim" | |
1103 | Animation43.Parent = StringValue42 | |
1104 | Animation43.AnimationId = "http://www.roblox.com/asset/?id=125749145" | |
1105 | StringValue44.Name = "toolnone" | |
1106 | StringValue44.Parent = Script30 | |
1107 | Animation45.Name = "ToolNoneAnim" | |
1108 | Animation45.Parent = StringValue44 | |
1109 | Animation45.AnimationId = "http://www.roblox.com/asset/?id=125750867" | |
1110 | StringValue46.Name = "walk" | |
1111 | StringValue46.Parent = Script30 | |
1112 | Animation47.Name = "WalkAnim" | |
1113 | Animation47.Parent = StringValue46 | |
1114 | Animation47.AnimationId = "http://www.roblox.com/asset/?id=125749145" | |
1115 | Script48.Name = "Chat" | |
1116 | Script48.Parent = Model1 | |
1117 | table.insert(cors,sandbox(Script48,function() | |
1118 | while true do | |
1119 | game:GetService("Chat"):Chat(script.Parent.Head, "Hi :3", Enum.ChatColor.Blue) | |
1120 | wait(3) | |
1121 | game:GetService("Chat"):Chat(script.Parent.Head, "Wanna be friends?", Enum.ChatColor.Blue) | |
1122 | wait(3) | |
1123 | game:GetService("Chat"):Chat(script.Parent.Head, "BUILDERMAN IS MY DAD", Enum.ChatColor.Blue) | |
1124 | wait(3) | |
1125 | game:GetService("Chat"):Chat(script.Parent.Head, "0M6 1'M R3P0R71NG Y0U!!111!!", Enum.ChatColor.Blue) | |
1126 | wait(3) | |
1127 | game:GetService("Chat"):Chat(script.Parent.Head, "TEH EPIK DUCK IS COMING", Enum.ChatColor.Blue) | |
1128 | wait(3) | |
1129 | game:GetService("Chat"):Chat(script.Parent.Head, "Yes", Enum.ChatColor.Blue) | |
1130 | wait(3) | |
1131 | game:GetService("Chat"):Chat(script.Parent.Head, "ALL YOUR BASES ARE BELONG TO ME", Enum.ChatColor.Blue) | |
1132 | wait(3) | |
1133 | end | |
1134 | ||
1135 | end)) | |
1136 | Script49.Name = "Respawn" | |
1137 | Script49.Parent = Model1 | |
1138 | table.insert(cors,sandbox(Script49,function() | |
1139 | name="Humanoid" | |
1140 | ||
1141 | robo=script.Parent:clone() | |
1142 | ||
1143 | while true do | |
1144 | wait(1) | |
1145 | if script.Parent.Humanoid.Health<1 then | |
1146 | robot=robo:clone() | |
1147 | robot.Parent=script.Parent.Parent | |
1148 | robot:makeJoints() | |
1149 | script.Parent:remove() | |
1150 | end | |
1151 | end | |
1152 | ||
1153 | ||
1154 | ||
1155 | ||
1156 | end)) | |
1157 | for i,v in pairs(mas:GetChildren()) do | |
1158 | v.Parent = workspace | |
1159 | pcall(function() v:MakeJoints() end) | |
1160 | end | |
1161 | mas:Destroy() | |
1162 | for i,v in pairs(cors) do | |
1163 | spawn(function() | |
1164 | pcall(v) | |
1165 | end) | |
1166 | end |