View difference between Paste ID: h4vk2a6H and CEFNPVyg
SHOW: | | - or go back to the newest paste.
1
print'Updated on 31.05.2014'
2
print'sweg, made by madiik, kthx'
3
function clerp(c1,c2,al)
4
    local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
5
    local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
6
    for i,v in pairs(com1) do 
7
        com1[i] = v+(com2[i]-v)*al
8
    end
9
    return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
10
end
11
12
plr = game:service'Players'.LocalPlayer
13
char = plr.Character
14
mouse = plr:GetMouse()
15
humanoid = char:findFirstChild("Humanoid")
16
torso = char:findFirstChild("Torso")
17
head = char.Head
18
ra = char:findFirstChild("Right Arm")
19
la = char:findFirstChild("Left Arm")
20
rl = char:findFirstChild("Right Leg")
21
ll = char:findFirstChild("Left Leg")
22
rs = torso:findFirstChild("Right Shoulder")
23
ls = torso:findFirstChild("Left Shoulder")
24
rh = torso:findFirstChild("Right Hip")
25
lh = torso:findFirstChild("Left Hip")
26
neck = torso:findFirstChild("Neck")
27
rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
28
anim = char:findFirstChild("Animate")
29
if anim then
30
anim:Destroy()
31
end
32
rootpart = char:findFirstChild("HumanoidRootPart")
33
camera = workspace.CurrentCamera
34
modelforparts = char:findFirstChild("ModelForParts") or Instance.new("Model", char)
35
modelforparts.Name = "ModelForParts"
36
37
function trailconnect(obj, wat)
38
local trail = {}
39
for i = 1, 4 do 
40
local p = Instance.new("Part") 
41
p.BrickColor = obj.BrickColor
42
p.formFactor = "Custom" 
43
p.Size = Vector3.new(1,1,1)
44
p.Locked = true 
45
p.Anchored = true 
46
p.CanCollide = false 
47
local mesh = Instance.new("CylinderMesh", p) 
48
mesh.Name = "Mesh" 
49
table.insert(trail,{p,0}) 
50
end
51
local lastpos = obj.Position 
52
local updatethis = 0 
53
local dontdothis = false
54
game:service'RunService'.Stepped:connect(function()
55
    if wat == true then if dontdothis then return end
56
        for i,v in pairs(trail) do
57
        game:service'Debris':AddItem(obj, 0)
58
        table.remove(v, i)
59
        end
60
        dontdothis = true
61
        return 
62
    end
63
updatethis = ((updatethis) % 4) + 1
64
local dstnc = (obj.Position - lastpos).magnitude 
65
trail[updatethis][1].Mesh.Scale = Vector3.new(.2,dstnc,.2)
66
trail[updatethis][1].Parent = obj.Parent
67
trail[updatethis][1].CFrame = CFrame.new((obj.Position + lastpos)/2,obj.Position) * CFrame.Angles(math.pi/2, 0, 0)
68
trail[updatethis][2] = 0 
69
for i,v in pairs(trail) do 
70
v[2] = v[2] + .15
71
v[1].Transparency = v[2] 
72
end 
73
lastpos = obj.Position
74
end)
75
end 
76
77
do --rayCast
78
    function rayCast(startpos, Speed, Gravity, Dmg, color)
79
        local ran,err = ypcall(function()
80
    local rayPart         = Instance.new("Part")
81
    rayPart.Name          = "RayPart"
82
    rayPart.BrickColor    = BrickColor.new(color)
83
    rayPart.Anchored      = true
84
    rayPart.CanCollide    = false
85
    rayPart.Locked        = true
86
    rayPart.FormFactor    = "Custom"
87
    rayPart.TopSurface    = Enum.SurfaceType.Smooth
88
    rayPart.BottomSurface = Enum.SurfaceType.Smooth
89
    rayPart.Size          = Vector3.new(.2, 50, .2)
90
    rayPart:breakJoints()
91
    Instance.new("CylinderMesh", rayPart)
92
    local fire = Instance.new("Fire", rayPart)
93
    fire.Color = rayPart.BrickColor.Color
94
    fire.SecondaryColor = rayPart.BrickColor.Color
95
    fire.Heat = 0
96
    fire.Size = 10
97
    local pl = Instance.new("PointLight", rayPart)
98
    pl.Color = Color3.new(rayPart.BrickColor.r/1.5, rayPart.BrickColor.g/1.5, rayPart.BrickColor.b/1.5)
99
    pl.Range = 18
100
101
    local hitobj = false
102
    local bulletposition = startpos.Position
103
    rayPart.CFrame = startpos.CFrame
104
    trailconnect(rayPart, hitobj)
105
106
   local bulletvelocity = (Vector3.new(math.random(-2,2), math.random(-2,2), math.random(-2,2)))+( mouse.Hit.p - bulletposition).unit*Speed
107
    local bulletlastposition = bulletposition
108
    
109
    coroutine.resume(coroutine.create(function()
110
        while true do
111
112
            local dt = wait()
113
            bulletlastposition = bulletposition
114
            bulletvelocity = bulletvelocity + (Vector3.new(0, -3.81*Gravity, 0)*dt)
115
            bulletposition = bulletposition + (bulletvelocity*dt)
116
            local ray = Ray.new(bulletlastposition,  (bulletposition - bulletlastposition))
117
            local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, {char, modelforparts} )
118
                
119
    if (torso.Position - rayPart.Position).magnitude > 840 then
120
        rayPart:Destroy()
121
        hitobj = true
122
     break
123
    end
124
125
    
126
            if hit then
127
                hitobj = true
128
                    local damage = math.random(Dmg, Dmg+6)
129
                if hit.Parent:findFirstChild("Humanoid") ~= nil then
130
                    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
131
                elseif hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") then
132
                    hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
133
                end
134
                local boom = Instance.new("Part", modelforparts)
135
                boom.BrickColor = rayPart.BrickColor
136
                boom.Anchored = true
137
                boom.FormFactor = "Custom"
138
                boom.Size = Vector3.new(1,1,1)
139
                boom.CanCollide = false
140
                boom.Transparency = 0.25
141
                boom.CFrame = CFrame.new(hitposition.x, hitposition.y, hitposition.z)
142
                boom.TopSurface = 0
143
                boom.BottomSurface = 0
144
                local sphere = Instance.new("SpecialMesh", boom)
145
                sphere.MeshType = "Sphere"
146
                local pl = Instance.new("PointLight", boom)
147
                pl.Color = Color3.new(boom.BrickColor.r/1.5, boom.BrickColor.g/1.5, boom.BrickColor.b/1.5)
148
                pl.Range = 20
149
                for ye = 0, 8 do
150
                    local lite = Instance.new("Part", boom)
151
                    lite.FormFactor = "Custom"
152
                    lite.Size = Vector3.new(.2, 1.5, .2)
153
                    lite.BrickColor = boom.BrickColor
154
                    lite.CanCollide = false
155
                    lite.TopSurface = 0
156
                    lite.Anchored = false
157
                    lite.BottomSurface = 0
158
                    lite.Position = boom.Position + Vector3.new(math.random(-10, 10), math.random(6,15), math.random(-10, 10))
159
                end
160
                    
161
                for i = 0, 20, 2.5 do
162
                    sphere.Scale = sphere.Scale + Vector3.new(i,i,i)
163
                    boom.Transparency = boom.Transparency + i/60
164
                    pl.Range = pl.Range + i/15
165
                 wait()
166
                end
167
                boom:Destroy()
168
            for i,v in pairs(workspace:children()) do
169
                if v:IsA("Model") and v:findFirstChild("Humanoid") then
170
                    if v:findFirstChild("Head") and v:findFirstChild("Torso") then
171
                    if (v:findFirstChild("Torso").Position - boom.Position).magnitude < 16 and v.Name ~= char.Name then
172
                    v:findFirstChild("Humanoid"):TakeDamage(math.random(Dmg+2,Dmg+6))
173
                    end
174
                    end
175
                end
176
                if v and v:IsA("Part") and v.Name ~= "Base" then
177
                    if (v.Position - boom.Position).magnitude < 16 then
178
                    v:BreakJoints()
179
                    v.TopSurface = 0
180
                    v.BottomSurface = 0
181
                    v.LeftSurface = 0
182
                    v.RightSurface = 0
183
                    v.FrontSurface = 0
184
                    v.BackSurface = 0
185
                    v.Anchored = false
186
                    end
187
                end
188
        end
189
            pcall(function()
190
                bulletposition = hitposition
191
                rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
192
                rayPart:Destroy()
193
            end)
194
                break
195
            end
196
            rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
197
            rayPart.Parent = modelforparts
198
        end
199
    end))
200
 for i = 70, 65, -1.5 do
201
    firing = true
202
    camera.FieldOfView = i
203
    wait()
204
end
205
for i = 65, 70, 2.5 do
206
    firing = false
207
    camera.FieldOfView = i
208
    wait()
209
end
210
end)
211
if err then
212
    print(err)
213
    end
214
end
215
end
216
217
218
charge = 100
219
220
plrgui = game:service'Players'.LocalPlayer:findFirstChild("PlayerGui")
221
222
local statusgui = Instance.new("ScreenGui", plrgui)
223
local mainframe = Instance.new("Frame", statusgui)
224
    mainframe.Size = UDim2.new(0, 200, 0, 200)
225
    mainframe.Position = UDim2.new(.75, 0, .75, 0)
226
    mainframe.Style = 3
227
    local image = Instance.new("ImageLabel", mainframe)
228
    image.Size = UDim2.new(1, 0, .47, 0)
229
    image.Position = UDim2.new(0, 0, .235, 0)
230
    image.BackgroundTransparency = 1
231
    image.Image = "rbxassetid://145057975"
232
    local chargetext = Instance.new("TextLabel", mainframe)
233
    chargetext.FontSize = "Size18"
234
    chargetext.Size = UDim2.new(1, 0, .95, 0)
235
    chargetext.TextYAlignment = "Bottom"
236
    chargetext.BackgroundTransparency = 1
237
    chargetext.TextColor3 = Color3.new(1,1,1)
238
    game:service'RunService'.Stepped:connect(function()
239
        chargetext.Text = math.floor(charge).."%"
240
    end)
241
    
242
    
243
244
local rm = Instance.new("Weld", torso)
245
rm.C0 = CFrame.new(1.5, 0.5, 0)
246
rm.C1 = CFrame.new(0, 0.5, 0)
247
rm.Part0 = torso
248
rm.Part1 = ra
249
local lm = Instance.new("Weld", torso)
250
lm.C0 = CFrame.new(-1.5, 0.5, 0)
251
lm.C1 = CFrame.new(0, 0.5, 0)
252
lm.Part0 = torso
253
lm.Part1 = la
254
255
sound = Instance.new("Sound", head)
256
sound.Volume = 1
257
sound.SoundId = "rbxassetid://144834276"
258
sound.Looped = true
259
260
261
dancemode = true
262
debounceofsprint = false
263
264
--create func
265
function part(parent, size, color, formfactor, collide, transparency)
266
    if transparency == nil then transparency=0 end
267
    if collide == nil then collide=false end
268
        if formfactor == nil then formfactor="Custom" end
269
        local p = Instance.new("Part", parent)
270
        p.FormFactor = formfactor
271
        p.CanCollide = collide
272
        p.Size = size
273
        p.Locked = true
274
        p.Transparency = transparency
275
        p.Position = torso.Position + Vector3.new(0, 1, 0)
276
        p.BrickColor = color
277
        p.FrontSurface = "SmoothNoOutlines" 
278
        p.BackSurface = "SmoothNoOutlines"         
279
        p.LeftSurface = "SmoothNoOutlines" 
280
        p.BottomSurface = "SmoothNoOutlines" 
281
        p.TopSurface = "SmoothNoOutlines"  
282
        p.RightSurface = "SmoothNoOutlines"
283
        return p
284
end
285
function wedge(parent, size, color, formfactor, collide, transparency)
286
        if transparency==nil then transparency=0 end
287
    if collide==nil then collide=false end
288
        if formfactor==nil then formfactor="Custom" end
289
        local p = Instance.new("WedgePart", parent)
290
        p.FormFactor = formfactor
291
        p.CanCollide = collide
292
        p.Size = size
293
        p.Locked = true
294
        p.Position = torso.Position
295
        p.BrickColor = color
296
        p.FrontSurface = "SmoothNoOutlines" 
297
        p.BackSurface = "SmoothNoOutlines"         
298
        p.LeftSurface = "SmoothNoOutlines" 
299
        p.BottomSurface = "SmoothNoOutlines" 
300
        p.TopSurface = "SmoothNoOutlines"  
301
        p.RightSurface = "SmoothNoOutlines"
302
        return p
303
end 
304
function weld(part0, part1, c0, parent, c1)
305
    if parent == nil then parent=char end
306
    if c1 == nil then c1=CFrame.new() end
307
308
        local wel = Instance.new("Weld", parent)
309
        wel.Part0 = part0
310
        wel.Part1 = part1
311
        wel.C0 = c0
312
        wel.C1 = c1
313
        return wel
314
end
315
function specialmesh(parent, meshType, scale, meshId)
316
    if meshId==nil then meshId="" end
317
        local mesh = Instance.new("SpecialMesh", parent)
318
        mesh.Scale = scale
319
        mesh.MeshType = meshType
320
        mesh.MeshId = meshId
321
        return mesh
322
end
323
----------------------------------------------------------------------------------------------------------
324
--function part(parent, size, color, formfactor, collide, transparency)
325
--function weld(part0, part1, c0, parent, c1)
326
327
----------------------------------------------------------------------------------------------------------
328
function animatehuman(animationid, object)
329
            local animation = object:findFirstChild("Humanoid"):LoadAnimation(animationid)
330
            animation:Play()
331
end
332
local danceAnim = Instance.new("Animation", char)
333
danceAnim.AnimationId = "http://www.roblox.com/asset/?id=130018893"
334
danceAnim.Name = "DancingAnimation"
335
----------------------------------------------------------------------------------------------------------
336
local main = Instance.new("Part", char)
337
        main.FormFactor = "Custom"
338
        main.CanCollide = false
339
        main.Size = Vector3.new(.75, 1, 1.2)
340
        main.Locked = true
341
        main.BrickColor = BrickColor.new("Black")
342
        main.TopSurface = 0
343
        main.BottomSurface = 0
344
        main.Position = torso.Position
345
        main:BreakJoints()
346
local weld1 = weld(main, ra, CFrame.new(), char, CFrame.new(0, -.8, -.6))
347
    local speaker = Instance.new("Part", char)
348
        speaker.FormFactor = "Custom"
349
        speaker.CanCollide = false
350
        speaker.Size = Vector3.new(1.5, .25, 1.4)
351
        speaker.Locked = true
352
        speaker.BrickColor = BrickColor.new("Black")
353
        speaker.TopSurface = 0
354
        speaker.BottomSurface = 0
355
        speaker.Position = torso.Position
356
        speaker:BreakJoints()
357
local weld2 = weld(speaker, main, CFrame.new(), char, CFrame.new(-.25, -1.7, .6))
358
        local speaker2 = Instance.new("Part", char)
359
        speaker2.FormFactor = "Custom"
360
        speaker2.CanCollide = false
361
        speaker2.Size = Vector3.new(1, .25, 2)
362
        speaker2.Locked = true
363
        speaker2.BrickColor = BrickColor.new("Black")
364
        speaker2.TopSurface = 0
365
        speaker2.BottomSurface = 0
366
        speaker2.Position = torso.Position
367
        speaker2:BreakJoints()
368
local weld3 = weld(speaker2, main, CFrame.new(), char, CFrame.new(0, -1.7, -.2))
369
        local main2 = Instance.new("Part", char)
370
        main2.FormFactor = "Custom"
371
        main2.CanCollide = false
372
        main2.Size = Vector3.new(.751, 1, .6)
373
        main2.Locked = true
374
        main2.BrickColor = BrickColor.new("Black")
375
        main2.TopSurface = 0
376
        main2.BottomSurface = 0
377
        main2.Position = torso.Position
378
        main2:BreakJoints()
379
local weld4 = weld(main2, ra, CFrame.new(), char, CFrame.new(0, 0, -.9))
380
    local main3 = Instance.new("Part", char)
381
        main3.FormFactor = "Custom"
382
        main3.CanCollide = false
383
        main3.Size = Vector3.new(.751, 1.45, 1)
384
        main3.Locked = true
385
        main3.BrickColor = BrickColor.new("Black")
386
        main3.TopSurface = 0
387
        main3.BottomSurface = 0
388
        main3.Position = torso.Position
389
        main3:BreakJoints()
390
local weld5 = weld(main3, ra, CFrame.new(), char, CFrame.new(0, -1.6, -.9))
391
    local main4 = Instance.new("Part", char)
392
        main4.FormFactor = "Custom"
393
        main4.CanCollide = false
394
        main4.Size = Vector3.new(1, .76, 1)
395
        Instance.new("CylinderMesh", main4)
396
        main4.Locked = true
397
        main4.BrickColor = BrickColor.new("Black")
398
        main4.TopSurface = 0
399
        main4.BottomSurface = 0
400
        main4.Position = torso.Position
401
        main4:BreakJoints()
402
local weld6 = weld(main4, main, CFrame.new(), char, CFrame.new(0, -.15, -.5)*CFrame.Angles(math.pi/2, 0, math.pi/2))
403
    local speaker3 = Instance.new("Part", char)
404
        speaker3.FormFactor = "Custom"
405
        speaker3.CanCollide = false
406
        speaker3.Size = Vector3.new(1.5, .5, 1.4)
407
        speaker3.Locked = true
408
        speaker3.BrickColor = BrickColor.new("Black")
409
        speaker3.TopSurface = 0
410
        speaker3.BottomSurface = 0
411
        speaker3.Position = torso.Position
412
        speaker3:BreakJoints()
413
local welds1 = weld(speaker3, main, CFrame.new(), char, CFrame.new(-.25, -2.2, .6))
414
        local speaker4 = Instance.new("Part", char)
415
        speaker4.FormFactor = "Custom"
416
        speaker4.CanCollide = false
417
        speaker4.Size = Vector3.new(1, .5, 2)
418
        speaker4.Locked = true
419
        speaker4.BrickColor = BrickColor.new("Black")
420
        speaker4.TopSurface = 0
421
        speaker4.BottomSurface = 0
422
        speaker4.Position = torso.Position
423
        speaker4:BreakJoints()
424
local welds2 = weld(speaker4, main, CFrame.new(), char, CFrame.new(0, -2.205, -.2))
425
        local speaker5 = Instance.new("Part", char)
426
        speaker5.FormFactor = "Custom"
427
        speaker5.CanCollide = false
428
        speaker5.Size = Vector3.new(1.4, .4, 1.3)
429
        speaker5.Locked = true
430
        speaker5.BrickColor = BrickColor.new("Black")
431
        speaker5.TopSurface = 0
432
        speaker5.BottomSurface = 0
433
        speaker5.Position = torso.Position
434
        speaker5:BreakJoints()
435
local welds3 = weld(speaker5, main, CFrame.new(), char, CFrame.new(-.25, -2, .6))
436
        local speaker6 = Instance.new("Part", char)
437
        speaker6.FormFactor = "Custom"
438
        speaker6.CanCollide = false
439
        speaker6.Size = Vector3.new(.9, .4, 1.9)
440
        speaker6.Locked = true
441
        speaker6.BrickColor = BrickColor.new("Black")
442
        speaker6.TopSurface = 0
443
        speaker6.BottomSurface = 0
444
        speaker6.Position = torso.Position
445
        speaker6:BreakJoints()
446
local welds4 = weld(speaker6, main, CFrame.new(), char, CFrame.new(0, -2, -.2))
447
    
448
        local support = Instance.new("Part", char)
449
        support.FormFactor = "Custom"
450
        support.CanCollide = false
451
        support.Size = Vector3.new(.3, .4, .6)
452
        support.Locked = true
453
        support.BrickColor = BrickColor.new("Black")
454
        support.TopSurface = 0
455
        support.BottomSurface = 0
456
        support.Position = torso.Position
457
        support:BreakJoints()
458
local welds5 = weld(support, main, CFrame.new(), char, CFrame.new(0, -1.5, -.4))
459
460
461
debounce = false
462
463
function stopsound()
464
if debounce then return end
465
    if not sound.IsPlaying then return end
466
    sound:stop()
467
    debounce = true
468
    local dancebro = Instance.new("StringValue", game:service'Lighting')
469
    dancebro.Name = ('STOPDANCING'..plr.Name)
470
    game:service'Debris':AddItem(dancebro, 1)
471
        coroutine.wrap(function()
472
        while not sound.IsPlaying do
473
            if charge <= 100 then
474
            charge = charge + .1
475
            wait()
476
            elseif charge > 100 then
477
            charge = 100
478
            break
479
            end
480
        end
481
    end)()
482
        wait(.1)
483
    debounce = false
484
end
485
mouse.Button1Down:connect(function(mous)
486
    if debounceofsprint then return end
487
    if sound.IsPlaying then return end
488
    if debounce then return end
489
    sound:play()
490
 for i = 70, 55, -.35 do
491
     if not sound.IsPlaying then debounce = true camera.FieldOfView = 70 return end
492
    camera.FieldOfView = i
493
    wait()
494
end
495
for i = 65, 70, 2.5 do
496
    if not sound.IsPlaying then debounce = true camera.FieldOfView = 70 return end
497
    camera.FieldOfView = i
498
    wait()
499
end
500
if debounce then debounce = false return end
501
    if dancemode then
502
    for i,v in pairs(workspace:children()) do
503
        if not sound.IsPlaying then break end
504
                coroutine.wrap(function()
505
                if v:IsA("Model") and v:findFirstChild("Humanoid") and v.Name ~= char.Name and v:findFirstChild("ModelForParts") == nil and v:findFirstChild("Torso") and (v:findFirstChild("Torso").Position - head.Position).magnitude < 30 then
506
                        danceAnimClone = danceAnim:clone()
507
                        danceAnimClone.Parent = v
508
                        danceAnimClone.AnimationId = "http://www.roblox.com/asset/?id=130018893"
509
                        wait()
510
                        NLS([[
511
                        function animatehuman(animationid, object)
512
                            local animation = object:findFirstChild("Humanoid"):LoadAnimation(animationid)
513
                            animation:Play()
514
                        end
515
                        while wait(.5) do
516
                        if game:service'Lighting':findFirstChild("STOPDANCING]]..plr.Name..[[") and game:service'Lighting':findFirstChild("STOPDANCING]]..plr.Name..[["):IsA("StringValue") then game:service'Debris':AddItem(script.Parent:findFirstChild("DancingAnimation"), 5) break end
517
                        animatehuman(script.Parent:findFirstChild("DancingAnimation"), script.Parent)
518
                        end
519
                        ]], v)
520
                end
521
                end)()
522
        end
523
end
524
    coroutine.wrap(function()
525
        while sound.IsPlaying do
526
            if charge <= 1 then 
527
                if debounce then break end
528
                if not sound.IsPlaying then break end
529
                    sound:stop()
530
                    debounce = true
531
                    chargetext.TextColor3 = Color3.new(1,0,0)
532
                    dancebro = Instance.new("StringValue", game:service'Lighting')
533
                    dancebro.Name = ('STOPDANCING'..plr.Name)
534
                    game:service'Debris':AddItem(dancebro, 1)
535
                    coroutine.wrap(function()
536
                        repeat wait() until charge >= 10
537
                        debounce = false
538
                        chargetext.TextColor3 = Color3.new(1,1,1)
539
                    end)()
540
                    coroutine.wrap(function()
541
                        while not sound.IsPlaying do
542
                            if charge <= 100 then
543
                            charge = charge + .1
544
                            wait()
545
                            elseif charge > 100 then
546
                            charge = 100
547
                            break
548
                            end
549
                        end
550
                    end)() 
551
            else
552
            charge = charge - .08
553
            wait()
554
            end
555
        end
556
    end)()
557
    coroutine.wrap(function()
558
        local ran,err = ypcall(function()
559
        while sound.IsPlaying and Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 20 do
560
    if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
561
    if not sound.IsPlaying then break end
562
    rayCast(speaker, 1250, 0, 5, "Lavender")
563
    wait(.35)
564
    if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
565
    if not sound.IsPlaying then break end
566
    rayCast(speaker, 1250, 0, 5, "Pink")
567
    wait(.95)
568
    if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
569
    if not sound.IsPlaying then break end
570
    rayCast(speaker, 1250, 0, 5, "Bright bluish green")
571
    wait(.55)
572
    if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
573
    if not sound.IsPlaying then break end
574
    rayCast(speaker, 1250, 0, 5, "Pink")
575
    wait(.4)
576
    if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
577
    if not sound.IsPlaying then break end
578
    rayCast(speaker, 1250, 0, 5, "Bright bluish green")
579
    local pl = Instance.new("PointLight", torso)
580
    pl.Color = Color3.new(153/255/1.25, 102/255/1.25, 204/255/1.25)
581
    pl.Range = 30
582
    pl.Brightness = 0.7
583
    game:service'Debris':AddItem(pl, .3)
584
    wait(.45)
585
    if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
586
    if not sound.IsPlaying then break end
587
    rayCast(speaker, 1250, 0, 5, "Lavender")
588
    wait(.75)
589
    end
590
    end) if err then print(err) end
591
    end)()
592
end)
593
594
mouse.Button1Up:connect(function(mous)
595
    stopsound()
596
end)
597
ctrl = false
598
mouse.KeyDown:connect(function(k)
599
    if string.byte(k) == 50 then
600
        ctrl = true
601
        humanoid.WalkSpeed = 8
602
    end
603
    if string.byte(k) == 48 then
604
    humanoid.WalkSpeed = 28
605
    end
606
end)
607
608
mouse.KeyUp:connect(function(k)
609
    if string.byte(k) == 50 then
610
        ctrl = false
611
        humanoid.WalkSpeed = 16
612
    end
613
    if string.byte(k) == 48 then
614
    humanoid.WalkSpeed = 16
615
        if ctrl then
616
            humanoid.WalkSpeed = 8
617
        end
618
    end
619
end)
620
621
humanoid.Died:connect(function()
622
    deathpos = torso.Position
623
    WorkModel = Instance.new("Model", workspace)
624
    WorkModel.Name = " "
625
        wait(1/60)
626
        humanoid.Parent = nil
627
    if torso then
628
        local Head = char:FindFirstChild("Head")
629
        if Head then
630
            local Neck = Instance.new("Weld")
631
            Neck.Name = "Neck"
632
            Neck.Part0 = torso
633
            Neck.Part1 = Head
634
            Neck.C0 = CFrame.new(0, 1.5, 0)
635
            Neck.C1 = CFrame.new()
636
            Neck.Parent = torso
637
        end
638
        local Limb = char:FindFirstChild("Right Arm")
639
        if Limb then
640
641
            Limb.CFrame = torso.CFrame * CFrame.new(1.5, 0, 0)
642
            local Joint = Instance.new("Glue")
643
            Joint.Name = "RightShoulder"
644
            Joint.Part0 = torso
645
            Joint.Part1 = Limb
646
            Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
647
            Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
648
            Joint.Parent = torso
649
650
            local B = Instance.new("Part")
651
            B.TopSurface = 0
652
            B.BottomSurface = 0
653
            B.formFactor = "Symmetric"
654
            B.Size = Vector3.new(1, 1, 1)
655
            B.Transparency = 1
656
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
657
            B.Parent = char
658
            B.CanCollide = false
659
            local W = Instance.new("Weld")
660
            W.Part0 = Limb
661
            W.Part1 = B
662
            W.C0 = CFrame.new(0, -0.5, 0)
663
            W.Parent = Limb
664
665
        end
666
        local Limb = char:FindFirstChild("Left Arm")
667
        if Limb then
668
669
            Limb.CFrame = torso.CFrame * CFrame.new(-1.5, 0, 0)
670
            local Joint = Instance.new("Glue")
671
            Joint.Name = "LeftShoulder"
672
            Joint.Part0 = torso
673
            Joint.Part1 = Limb
674
            Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
675
            Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
676
            Joint.Parent = torso
677
678
            local B = Instance.new("Part")
679
            B.TopSurface = 0
680
            B.BottomSurface = 0
681
            B.formFactor = "Symmetric"
682
            B.Size = Vector3.new(1, 1, 1)
683
            B.Transparency = 1
684
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
685
            B.Parent = char
686
            B.CanCollide = false
687
            local W = Instance.new("Weld")
688
            W.Part0 = Limb
689
            W.Part1 = B
690
            W.C0 = CFrame.new(0, -0.5, 0)
691
            W.Parent = Limb
692
693
        end
694
        local Limb = char:FindFirstChild("Right Leg")
695
        if Limb then
696
697
            Limb.CFrame = torso.CFrame * CFrame.new(0.5, -2, 0)
698
            local Joint = Instance.new("Glue")
699
            Joint.Name = "RightHip"
700
            Joint.Part0 = torso
701
            Joint.Part1 = Limb
702
            Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
703
            Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
704
            Joint.Parent = torso
705
706
            local B = Instance.new("Part")
707
            B.TopSurface = 0
708
            B.BottomSurface = 0
709
            B.formFactor = "Symmetric"
710
            B.Size = Vector3.new(1, 1, 1)
711
            B.Transparency = 1
712
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
713
            B.Parent = char
714
            B.CanCollide = false
715
            local W = Instance.new("Weld")
716
            W.Part0 = Limb
717
            W.Part1 = B
718
            W.C0 = CFrame.new(0, -0.5, 0)
719
            W.Parent = Limb
720
721
        end
722
        local Limb = char:FindFirstChild("Left Leg")
723
        if Limb then
724
725
            Limb.CFrame = torso.CFrame * CFrame.new(-0.5, -2, 0)
726
            local Joint = Instance.new("Glue")
727
            Joint.Name = "LeftHip"
728
            Joint.Part0 = torso
729
            Joint.Part1 = Limb
730
            Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
731
            Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
732
            Joint.Parent = torso
733
734
            local B = Instance.new("Part")
735
            B.TopSurface = 0
736
            B.BottomSurface = 0
737
            B.formFactor = "Symmetric"
738
            B.Size = Vector3.new(1, 1, 1)
739
            B.Transparency = 1
740
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
741
            B.Parent = char
742
            B.CanCollide = false
743
            local W = Instance.new("Weld")
744
            W.Part0 = Limb
745
            W.Part1 = B
746
            W.C0 = CFrame.new(0, -0.5, 0)
747
            W.Parent = Limb
748
        end
749
        for blood = 0, 3 do
750
            local blood = Instance.new("Part", workspace)
751
            blood.BrickColor = BrickColor.Red()
752
            blood.FormFactor = "Custom"
753
            blood.Size = Vector3.new(.2,.2,.2)
754
            blood.Anchored = true
755
            blood.TopSurface = "Smooth"
756
            blood.BackSurface = "Smooth"
757
            local bloodmesh = Instance.new("CylinderMesh", blood)
758
            bloodmesh.Scale = Vector3.new(3, 0, 3)
759
            local rayzb = Ray.new(torso.Position, Vector3.new(0, -20, 0) + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)))
760
            local hitzb, hitposb = workspace:findPartOnRay(rayzb, char)
761
            if hitzb then
762
            blood.CFrame = CFrame.new(hitposb.x,hitposb.y,hitposb.z)
763
            blood.CFrame = blood.CFrame * CFrame.new(0, .05, 0)
764
                coroutine.wrap(function()
765
                    for cframe = 0, math.random(16, 24) do
766
                        bloodmesh.Scale = bloodmesh.Scale + Vector3.new(.45, 0, .45)
767
                        wait()
768
                    end
769
                end)()
770
            elseif not hitzb then
771
            blood:Destroy()
772
            end
773
        end
774
        local BP = Instance.new("BodyPosition", torso)
775
        BP.maxForce = Vector3.new(1,1,1)/0
776
        BP.position = deathpos
777
        for i,v in pairs(char:children()) do
778
            if v:IsA("Part") then v.Parent = WorkModel end
779
        end
780
        wait(.3)
781
        BP:Destroy()
782
    end
783
end)
784
785
local rlegm = Instance.new("Motor", torso)
786
rlegm.C0 = CFrame.new(0.5, -1, 0)
787
rlegm.C1 = CFrame.new(0, 1, 0)
788
rlegm.Part0 = torso
789
rlegm.Part1 = rl
790
rlegm.Name = "Right Hip"
791
local llegm = Instance.new("Motor", torso)
792
llegm.C0 = CFrame.new(-0.5, -1, 0)
793
llegm.C1 = CFrame.new(0, 1, 0)
794
llegm.Part0 = torso
795
llegm.Part1 = ll
796
llegm.Name = "Left Hip"
797
neck.C0 = CFrame.new(0, 1, 0)
798
neck.C1 = CFrame.new(0, -0.5, 0)
799
rj.C0 = CFrame.new(0, -1, 0)
800
rj.C1 = CFrame.new(0, -1, 0)
801
rsc0 = rm.C0
802
lsc0 = lm.C0
803
neckc0 = neck.C0
804
rootc0 = rj.C0
805
llc0 = llegm.C0
806
rlc0 = rlegm.C0
807
speed = 0.4
808
angle = 0
809
anglespeed = 0
810
mvmnt = 0
811
game:service'RunService'.RenderStepped:connect(function()
812
    angle = (angle % 100) + anglespeed/10
813
    mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
814
        local rscf = rsc0
815
        local lscf = lsc0
816
        local rlcf = rlc0
817
        local llcf = llc0
818
        local rjcf = rootc0
819
        local ncf = neckc0
820
        local rayz = Ray.new(rootpart.Position, Vector3.new(0, -4.1, 0))
821
        local hitz, enz = workspace:findPartOnRay(rayz, char)
822
        --math.asin(mouse.UnitRay.Direction.y)
823
        ncf = neckc0 * CFrame.Angles(camera.CoordinateFrame.lookVector.y, 0, 0)
824
        rscf = rsc0 * CFrame.new(-.55, 0, .35) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, 0)
825
        lscf = lsc0 * CFrame.new(.85, 0, -.65) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, math.rad(45))
826
        if firing then
827
            rscf = rsc0 * CFrame.new(-.55, .15, .65) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, 0)
828
            lscf = lsc0 * CFrame.new(.85, .15, -.35) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, math.rad(45)) 
829
        end
830
        if not hitz then
831
            ncf = neckc0 * CFrame.Angles(math.pi/18, 0, 0)
832
                rscf = rsc0 * CFrame.new(-.45, 0, -.75) * CFrame.Angles(math.pi/5+math.pi/18, 0, math.rad(-70))
833
                lscf = lsc0 * CFrame.new(.35, 0, 0) * CFrame.Angles(math.pi/3.5+math.pi/18, 0, 0)
834
            rjcf = rootc0 * CFrame.Angles(-math.pi/32, 0, 0)
835
                rlcf = rlc0 * CFrame.new(0, 0.7, -0.5) * CFrame.Angles(-math.pi/14, 0, 0)
836
                llcf = llc0 * CFrame.Angles(-math.pi/20, 0, 0)
837
        elseif humanoid.Sit then
838
            ncf = neckc0 * CFrame.Angles(0, 0, 0)
839
            rjcf = rootc0 * CFrame.new(0, -.2, 0)
840
            rlcf = rlc0 * CFrame.Angles(math.pi/2, 0, math.rad(7.5))
841
            llcf = llc0 * CFrame.Angles(math.pi/2, 0, -math.rad(7.5))
842
            if sprinting then
843
                debounceofsprint = false
844
                sprinting = false
845
            end
846
        elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 2 then
847
            speed = 0.3
848
            if ctrl then
849
                rjcf = rootc0 * CFrame.new(0, -1.25, 0)
850
                llcf = llc0 * CFrame.new(0, 0, -.45) * CFrame.Angles(-math.pi/2.2, 0, 0)
851
                rlcf = rlcf * CFrame.new(0, 1.25, -.85)
852
            else
853
                rjcf = rootc0
854
                rlcf = rlc0 * CFrame.Angles(-math.rad(.5), 0, math.rad(1.5))
855
                llcf = llc0 * CFrame.Angles(math.rad(1.5), 0, -math.rad(1.5))
856
            end
857
    elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 20 then
858
        if not humanoid.Sit then
859
            anglespeed = 2
860
            if ctrl then
861
                anglespeed = 3
862
                ncf = neckc0 * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/18, 0, 0)
863
                rjcf = rootc0 * CFrame.new(0, -.35, 0) * CFrame.Angles(-math.pi/18, 0, 0)
864
                rscf = rsc0 * CFrame.new(-.55, 0, .35) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2+math.pi/18, 0, 0)
865
                lscf = lsc0 * CFrame.new(.85, 0, -.65) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2+math.pi/18, 0, math.rad(45))
866
                llcf = llc0 * CFrame.new(0, .45, -.35) * CFrame.Angles(math.pi/18 - math.sin(angle)*.45, 0, 0)
867
                rlcf = rlcf * CFrame.new(0, .45, -.35) * CFrame.Angles(math.pi/18 + math.sin(angle)*.45, 0, 0)
868
            else
869
                rjcf = rootc0
870
                rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*.65, 0, math.rad(.5))
871
                llcf = llc0 * CFrame.Angles(math.sin(angle)*.65, 0, -math.rad(.5))
872
            end
873
            if sprinting then
874
                debounceofsprint = false
875
                sprinting = false
876
            end
877
            end
878
        elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then
879
            if not humanoid.Sit then
880
            anglespeed = 2.7
881
                ncf = neckc0 * CFrame.Angles(math.pi/18, 0, 0)
882
                rscf = rsc0 * CFrame.new(-.45, 0, -.75) * CFrame.Angles(math.pi/5+math.pi/18, 0, math.rad(-70))
883
                lscf = lsc0 * CFrame.new(.35, 0, 0) * CFrame.Angles(math.pi/3.5+math.pi/18, 0, 0)
884
                rjcf = rootc0 * CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/18, math.sin(angle)*.1, math.sin(angle)*.045)
885
                rlcf = rlc0 * CFrame.new(0, .3 + -math.cos(-angle)*.3, -.2+math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5))
886
                llcf = llc0 * CFrame.new(0, .3 - -math.cos(angle)*.3, -.05-math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5))
887
            sprinting = true
888
            debounceofsprint = true
889
            end
890
        end
891
    rm.C0 = clerp(rm.C0,rscf,speed)
892
    lm.C0 = clerp(lm.C0,lscf,speed)
893
    rj.C0 = clerp(rj.C0,rjcf,speed)
894
    rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
895
    llegm.C0 = clerp(llegm.C0,llcf,speed)
896
    neck.C0 = clerp(neck.C0,ncf,speed)
897
end)