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