SHOW:
|
|
- or go back to the newest paste.
1 | --[[ | |
2 | - | --Complete functional 2008 like Animate script + more old 2008 movement functions! |
2 | + | How ROBLOX's updated r6 animation script shouldve been like by now |
3 | ||
4 | - | --this includes some old coding from the original classic animation script |
4 | + | Complete functional 2008 like Animate script + more old 2008 movement functions! |
5 | ||
6 | - | --originally only works as localscript but had to edit it to work on void sb |
6 | + | this includes some old coding from the original classic animation script but updated |
7 | - | --this actually is just a test but you can use it anyway |
7 | + | |
8 | //.-.\\ | |
9 | - | --//.-.\\ |
9 | + | |
10 | Remade by Protofer_S | |
11 | - | --Remade by Protofer_S |
11 | + | |
12 | \\.-.// | |
13 | - | --\\.-.// |
13 | + | |
14 | ]] | |
15 | - | -- util |
15 | + | |
16 | ||
17 | - | function waitForChild(parent, childName) |
17 | + | |
18 | - | while true do |
18 | + | |
19 | - | local child = parent:findFirstChild(childName) |
19 | + | |
20 | - | if child then |
20 | + | |
21 | - | return child |
21 | + | |
22 | return sound | |
23 | - | parent.ChildAdded:wait() |
23 | + | |
24 | ||
25 | ||
26 | ||
27 | ||
28 | local Player = game:GetService("Players").LocalPlayer | |
29 | local Figure = Player.Character | |
30 | local Torso = Figure:WaitForChild("Torso") | |
31 | local Lefthip = Torso:WaitForChild("Left Hip") | |
32 | local Righthip = Torso:WaitForChild("Right Hip") | |
33 | local Humanoid = Figure:FindFirstChildOfClass("Humanoid") | |
34 | local Rightshoulder = Torso:WaitForChild("Right Shoulder") | |
35 | - | -- declarations |
35 | + | |
36 | local walkspeed = Humanoid.WalkSpeed | |
37 | - | local Figure = owner.Character |
37 | + | |
38 | - | local Torso = waitForChild(Figure, "Torso") |
38 | + | |
39 | local jumpMaxLimbVelocity = 0.5 | |
40 | - | Humanoid:ClearAllChildren() |
40 | + | |
41 | - | Humanoid.RequiresNeck=false |
41 | + | |
42 | - | Instance.new("Animator",Humanoid).Name="Animator" |
42 | + | |
43 | - | local oldanim = Figure:FindFirstChild("Animate") |
43 | + | |
44 | - | if oldanim then oldanim.Disabled=true end |
44 | + | |
45 | local MAINDISK = nil | |
46 | local moveto = nil | |
47 | local newpath = false | |
48 | - | local sFreeFalling = newSound("rbxasset://sounds/button.wav",Torso) |
48 | + | |
49 | local pathwait | |
50 | local usingtool = false | |
51 | local Pose = "standing" | |
52 | Mouse.Icon = "rbxassetid://172802980" | |
53 | local oldanimate = Figure:FindFirstChild("Animate") | |
54 | if oldanimate then oldanimate.Disabled=true Humanoid:ClearAllChildren() end | |
55 | ||
56 | - | -- functions |
56 | + | |
57 | ||
58 | ||
59 | local sDied = newSound("rbxasset://sounds/uuhhh.wav",Torso) | |
60 | local sFallingDown = newSound("rbxasset://sounds/splat.wav",Torso) | |
61 | local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav",Torso) | |
62 | local sGettingUp = newSound("rbxasset://sounds/hit.wav",Torso) | |
63 | local sJumping = newSound("rbxasset://sounds/button.wav",Torso) | |
64 | local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3",Torso) | |
65 | sRunning.Looped = true | |
66 | ||
67 | ||
68 | ||
69 | function clickmovement(END) | |
70 | if usingtool then return end | |
71 | if not newpath then | |
72 | newpath=true | |
73 | END = Mouse.Hit.p | |
74 | moveto = createdisk() | |
75 | moveto.Position = END | |
76 | moveto.Orientation = Vector3.new(0,0,90) | |
77 | local path = P:CreatePath() | |
78 | - | -- connect up |
78 | + | |
79 | local waypoints = path:GetWaypoints() | |
80 | if path.Status == Enum.PathStatus.Success then | |
81 | for _, waypoint in pairs(waypoints) do | |
82 | if waypoint.Action == Enum.PathWaypointAction.Jump then | |
83 | Humanoid.Jump = true | |
84 | end | |
85 | if newpath then | |
86 | Humanoid:MoveTo(waypoint.Position) | |
87 | - | function makeJoint(limbName, jointName, c0, c1) |
87 | + | |
88 | - | local limb = waitForChild(Figure, limbName) |
88 | + | |
89 | - | if limb.Name=="Head" then |
89 | + | |
90 | end | |
91 | end | |
92 | - | limb:BreakJoints() |
92 | + | |
93 | newpath=false | |
94 | moveto:Destroy() | |
95 | - | local joint = Instance.new"Motor" |
95 | + | |
96 | - | joint.Name = jointName |
96 | + | |
97 | if moveto~=nil then | |
98 | - | joint.Part0 = Torso |
98 | + | |
99 | - | joint.Part1 = limb |
99 | + | |
100 | - | joint.C0 = c0 |
100 | + | |
101 | - | joint.C1 = c1 |
101 | + | |
102 | - | joint.MaxVelocity = 0.5 |
102 | + | |
103 | - | joint.archivable = true |
103 | + | |
104 | - | joint.Parent = Torso |
104 | + | |
105 | - | return joint |
105 | + | |
106 | if MAINDISK~=nil then | |
107 | MAINDISK.CFrame = Mouse.Hit | |
108 | MAINDISK.Orientation = Vector3.new(0, 0, 90) | |
109 | local TOOL = 0 | |
110 | - | local Neck = makeJoint("Head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)) |
110 | + | |
111 | - | local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)) |
111 | + | |
112 | - | local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)) |
112 | + | |
113 | - | local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)) |
113 | + | |
114 | - | local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)) |
114 | + | |
115 | for i,v in pairs(Player.Character:children()) do | |
116 | - | NLS([[ |
116 | + | |
117 | TOOL=TOOL+1 | |
118 | end | |
119 | end | |
120 | if TOOL~=0 then | |
121 | usingtool=true | |
122 | if MAINDISK.Parent~=nil then | |
123 | MAINDISK.Transparency=1 | |
124 | end | |
125 | else | |
126 | if MAINDISK.Parent~=nil then | |
127 | MAINDISK.Transparency=0 | |
128 | end | |
129 | usingtool=false | |
130 | end | |
131 | end | |
132 | end | |
133 | ||
134 | function createdisk() | |
135 | wait() | |
136 | local Disc = Instance.new("Part", Figure) | |
137 | if usingtool then | |
138 | Disc.Transparency=1 | |
139 | end | |
140 | Disc.Shape = "Cylinder" | |
141 | Disc.Size = Vector3.new(0.5, 3.5, 2.5) | |
142 | Disc.TopSurface = Enum.SurfaceType.Smooth | |
143 | Disc.BottomSurface = Enum.SurfaceType.Smooth | |
144 | Disc.Anchored = true | |
145 | Disc.CanCollide = false | |
146 | Disc.BrickColor = BrickColor.new("Lime green") | |
147 | return Disc | |
148 | end | |
149 | MAINDISK = createdisk() | |
150 | local rem = removing:Connect(function(ob) | |
151 | if ob==MAINDISK then | |
152 | MAINDISK = createdisk() | |
153 | end | |
154 | end) | |
155 | ||
156 | ||
157 | ||
158 | - | local sFreeFalling = newSound("rbxasset://sounds/button.wav",Torso) |
158 | + | |
159 | coroutine.resume(coroutine.create(function() | |
160 | if canjump then | |
161 | local oldpower = Humanoid.JumpPower | |
162 | canjump=false | |
163 | local GYRO = Instance.new("BodyGyro",Torso) | |
164 | GYRO.D = 25 | |
165 | GYRO.P = 20000 | |
166 | GYRO.MaxTorque = Vector3.new(0,math.huge,0) | |
167 | GYRO.CFrame = CFrame.new(Torso.Position,Torso.CFrame*CFrame.new(0,0,-3).Position) | |
168 | while wait() do | |
169 | if Pose~="falling" and Pose~="jumping" then | |
170 | break | |
171 | else | |
172 | if not canjump then | |
173 | Humanoid.JumpPower=0 | |
174 | end | |
175 | end | |
176 | end | |
177 | GYRO:Destroy() | |
178 | wait(.6) | |
179 | Humanoid.JumpPower = oldpower | |
180 | canjump=true | |
181 | end | |
182 | end)) | |
183 | end | |
184 | ||
185 | function moveJump() | |
186 | Rightshoulder.MaxVelocity = jumpMaxLimbVelocity | |
187 | Leftshoulder.MaxVelocity = jumpMaxLimbVelocity | |
188 | Rightshoulder:SetDesiredAngle(3.14) | |
189 | Leftshoulder:SetDesiredAngle(-3.14) | |
190 | Righthip:SetDesiredAngle(0) | |
191 | Lefthip:SetDesiredAngle(0) | |
192 | end | |
193 | ||
194 | function moveFreeFall() | |
195 | Rightshoulder.MaxVelocity = jumpMaxLimbVelocity | |
196 | Leftshoulder.MaxVelocity = jumpMaxLimbVelocity | |
197 | Rightshoulder:SetDesiredAngle(3.14) | |
198 | Leftshoulder:SetDesiredAngle(-3.14) | |
199 | Righthip:SetDesiredAngle(0) | |
200 | Lefthip:SetDesiredAngle(0) | |
201 | end | |
202 | ||
203 | function moveclimb(desiredangle,climbangle) | |
204 | Leftshoulder.MaxVelocity=jumpMaxLimbVelocity | |
205 | Rightshoulder.MaxVelocity=jumpMaxLimbVelocity | |
206 | Lefthip:SetDesiredAngle(-desiredangle*6.65) | |
207 | Righthip:SetDesiredAngle(-desiredangle*6.65) | |
208 | Leftshoulder:SetDesiredAngle(desiredangle*6.5-climbangle) | |
209 | Rightshoulder:SetDesiredAngle(desiredangle*6.5+climbangle) | |
210 | end | |
211 | ||
212 | function moveSit() | |
213 | Rightshoulder.MaxVelocity = 0.15 | |
214 | Leftshoulder.MaxVelocity = 0.15 | |
215 | Rightshoulder:SetDesiredAngle(3.14 /2) | |
216 | Leftshoulder:SetDesiredAngle(-3.14 /2) | |
217 | Righthip:SetDesiredAngle(3.14 /2) | |
218 | Lefthip:SetDesiredAngle(-3.14 /2) | |
219 | end | |
220 | ||
221 | function getTool() | |
222 | for _, kid in ipairs(Figure:GetChildren()) do | |
223 | if kid.className == "Tool" then return kid end | |
224 | end | |
225 | return nil | |
226 | end | |
227 | ||
228 | function getToolAnim(tool) | |
229 | for _, c in ipairs(tool:GetChildren()) do | |
230 | if c.Name == "toolanim" and c.className == "StringValue" then | |
231 | return c | |
232 | end | |
233 | end | |
234 | return nil | |
235 | end | |
236 | ||
237 | function animateTool() | |
238 | ||
239 | if (toolAnim == "None") then | |
240 | Rightshoulder:SetDesiredAngle(1.57) | |
241 | return | |
242 | end | |
243 | ||
244 | if (toolAnim == "Slash") then | |
245 | Rightshoulder.MaxVelocity = 0.5 | |
246 | Rightshoulder:SetDesiredAngle(0) | |
247 | return | |
248 | end | |
249 | ||
250 | if (toolAnim == "Lunge") then | |
251 | Rightshoulder.MaxVelocity = 0.5 | |
252 | Leftshoulder.MaxVelocity = 0.5 | |
253 | Righthip.MaxVelocity = 0.5 | |
254 | Lefthip.MaxVelocity = 0.5 | |
255 | Rightshoulder:SetDesiredAngle(1.57) | |
256 | Leftshoulder:SetDesiredAngle(1.0) | |
257 | Righthip:SetDesiredAngle(1.57) | |
258 | Lefthip:SetDesiredAngle(1.0) | |
259 | - | canjump=false |
259 | + | |
260 | end | |
261 | end | |
262 | ||
263 | function Move(desiredangle,time) | |
264 | if Pose=="running" or Pose=="climbing" or Pose=="falling" then | |
265 | local anglespeed = 0.2 - walkspeed*0.005 | |
266 | if anglespeed>0.01 then | |
267 | movespeed=anglespeed | |
268 | FPS=0.05 | |
269 | - | wait(.5) |
269 | + | |
270 | movespeed=0.01 | |
271 | - | canjump=true |
271 | + | |
272 | end | |
273 | if Pose=="climbing" then | |
274 | Humanoid:MoveTo(Torso.CFrame*CFrame.new(0,0,-1.5).Position) | |
275 | ||
276 | end | |
277 | end | |
278 | if Pose=="jumping" then | |
279 | moveJump() | |
280 | return | |
281 | end | |
282 | ||
283 | if Pose=="falling" then | |
284 | moveFreeFall() | |
285 | return | |
286 | end | |
287 | ||
288 | if Pose=="climbing" then | |
289 | moveclimb(desiredangle,math.rad(180)) | |
290 | return | |
291 | end | |
292 | ||
293 | if Pose=="sitting" then | |
294 | moveSit() | |
295 | return | |
296 | end | |
297 | if Pose=="running" then | |
298 | ||
299 | ANGLE=9.5 | |
300 | Lefthip:SetDesiredAngle(-desiredangle*6.65) | |
301 | Righthip:SetDesiredAngle(-desiredangle*6.65) | |
302 | Leftshoulder:SetDesiredAngle(desiredangle*6.5+desiredangle) | |
303 | Rightshoulder:SetDesiredAngle(desiredangle*6.5+desiredangle) | |
304 | --Lefthip.DesiredAngle = -desiredangle*6.65+desiredangle | |
305 | --Righthip.DesiredAngle = -desiredangle*6.65+desiredangle | |
306 | --Rightshoulder.DesiredAngle = desiredangle*6.5+desiredangle | |
307 | --Leftshoulder.DesiredAngle = desiredangle*6.5+desiredangle | |
308 | if (Rightshoulder.CurrentAngle > 1.5 or Rightshoulder.CurrentAngle < -1.5) then | |
309 | Rightshoulder.MaxVelocity = 0.1 | |
310 | else | |
311 | if movespeed>-0.01 then | |
312 | Rightshoulder.MaxVelocity = 0.15 | |
313 | Righthip.MaxVelocity = 0.2 | |
314 | else | |
315 | Righthip.MaxVelocity = .7 | |
316 | Rightshoulder.MaxVelocity = .7 | |
317 | end | |
318 | end | |
319 | if (Leftshoulder.CurrentAngle > 1.5 or Leftshoulder.CurrentAngle < -1.5) then | |
320 | Leftshoulder.MaxVelocity = 0.1 | |
321 | else | |
322 | if movespeed>-0.01 then | |
323 | Leftshoulder.MaxVelocity = 0.15 | |
324 | Lefthip.MaxVelocity = 0.2 | |
325 | else | |
326 | Lefthip.MaxVelocity = .7 | |
327 | Leftshoulder.MaxVelocity = .7 | |
328 | end | |
329 | end | |
330 | end | |
331 | if Pose=="standing" or Pose=="platformstand" then | |
332 | if (Rightshoulder.CurrentAngle > 1.5 or Rightshoulder.CurrentAngle < -1.5) then | |
333 | Rightshoulder.MaxVelocity = 0.25 | |
334 | end | |
335 | if (Leftshoulder.CurrentAngle > 1.5 or Leftshoulder.CurrentAngle < -1.5) then | |
336 | Leftshoulder.MaxVelocity = 0.25 | |
337 | end | |
338 | ANGLE=10 | |
339 | movespeed = 1 | |
340 | Lefthip.DesiredAngle = -desiredangle | |
341 | Righthip.DesiredAngle = -desiredangle | |
342 | Rightshoulder.DesiredAngle = desiredangle | |
343 | Leftshoulder.DesiredAngle = desiredangle | |
344 | end | |
345 | ||
346 | ||
347 | ||
348 | local tool = getTool() | |
349 | ||
350 | if tool then | |
351 | animStringValueObject = getToolAnim(tool) | |
352 | ||
353 | if animStringValueObject then | |
354 | toolAnim = animStringValueObject.Value | |
355 | -- message recieved, delete StringValue | |
356 | animStringValueObject.Parent = nil | |
357 | toolAnimTime = time+.3 | |
358 | end | |
359 | ||
360 | if time > toolAnimTime then | |
361 | toolAnimTime = 0 | |
362 | toolAnim = "None" | |
363 | end | |
364 | ||
365 | animateTool() | |
366 | ||
367 | ||
368 | else | |
369 | toolAnim = "None" | |
370 | toolAnimTime = 0 | |
371 | end | |
372 | ||
373 | ||
374 | end | |
375 | ||
376 | function onSeated() | |
377 | Pose="sitting" | |
378 | end | |
379 | ||
380 | function onRunning(speed) | |
381 | --if Pose=="climbing" then return end | |
382 | local Torsovelocity = (Torso.Velocity * Vector3.new(1,0,1)).magnitude | |
383 | if speed>0 then | |
384 | Pose="running" | |
385 | sRunning:play() | |
386 | else | |
387 | movespeed=1 | |
388 | Pose="standing" | |
389 | sRunning:pause() | |
390 | end | |
391 | end | |
392 | ||
393 | function onDied() | |
394 | Pose="died" | |
395 | sDied:play() | |
396 | end | |
397 | ||
398 | function onJumping() | |
399 | Pose="jumping" | |
400 | sJumping:Play() | |
401 | end | |
402 | ||
403 | function onClimbing() | |
404 | Pose="climbing" | |
405 | end | |
406 | ||
407 | function onGettingUp() | |
408 | Pose="standingup" | |
409 | end | |
410 | ||
411 | function onFreeFall() | |
412 | Pose="falling" | |
413 | end | |
414 | ||
415 | function onFallingDown() | |
416 | Pose="falling" | |
417 | end | |
418 | ||
419 | function onPlatformStanding() | |
420 | Pose="platformstand" | |
421 | end | |
422 | ||
423 | function onSwimming() | |
424 | Pose="swimming" | |
425 | end | |
426 | ||
427 | ||
428 | ||
429 | ||
430 | ||
431 | Humanoid.Died:connect(onDied) | |
432 | Humanoid.Running:connect(onRunning) | |
433 | Humanoid.Jumping:connect(onJumping) | |
434 | Humanoid.Climbing:connect(onClimbing) | |
435 | Humanoid.GettingUp:connect(onGettingUp) | |
436 | Humanoid.FreeFalling:connect(onFreeFall) | |
437 | Humanoid.FallingDown:connect(onFallingDown) | |
438 | Humanoid.Seated:connect(onSeated) | |
439 | Humanoid.PlatformStanding:connect(onPlatformStanding) | |
440 | Humanoid.Swimming:connect(onSwimming) | |
441 | Mouse.Button1Down:Connect(clickmovement) | |
442 | ||
443 | ||
444 | --sound functions | |
445 | ||
446 | ||
447 | ||
448 | function onState(state, sound) | |
449 | if state then | |
450 | sound:play() | |
451 | else | |
452 | sound:pause() | |
453 | end | |
454 | end | |
455 | ||
456 | ||
457 | Humanoid.Jumping:connect(function(state) onState(state, sJumping) end) | |
458 | Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end) | |
459 | Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end) | |
460 | Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end) | |
461 | ||
462 | ||
463 | while true do | |
464 | local _, time = wait(FPS) | |
465 | if Figure.Parent~=nil then else | |
466 | rem:Disconnect() break | |
467 | end | |
468 | local jumpVelocity = Torso.Velocity.y | |
469 | walkspeed = Humanoid.WalkSpeed | |
470 | local angle = math.sin(-tick()/movespeed)/ANGLE | |
471 | - | --sRunning:play() |
471 | + | |
472 | if jumpVelocity>5 or jumpVelocity<-5 then | |
473 | jumpcooldown(jumpVelocity) | |
474 | end | |
475 | - | --sRunning:pause() |
475 | + | |
476 | end | |
477 | ||
478 | ||
479 | ||
480 | ||
481 | - | --sDied:play() |
481 | + |