View difference between Paste ID: GZ3HH6uu and A8gu7hE7
SHOW: | | - or go back to the newest paste.
1
function weld(p0,p1,c0,c1,par)
2
        local w = Instance.new("Weld",p0 or par)
3
        w.Part0 = p0
4
        w.Part1 = p1
5
        w.C0 = c0 or CFrame.new()
6
        w.C1 = c1 or CFrame.new()
7
        return w
8
end
9
do -- Credit to Stravant...
10
        local function QuaternionFromCFrame(cf) local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() local trace = m00 + m11 + m22 if trace > 0 then local s = math.sqrt(1 + trace) local recip = 0.5/s return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 else local i = 0 if m11 > m00 then i = 1 end if m22 > (i == 0 and m00 or m11) then i = 2 end if i == 0 then local s = math.sqrt(m00-m11-m22+1) local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip elseif i == 1 then local s = math.sqrt(m11-m22-m00+1) local recip = 0.5/s return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip elseif i == 2 then local s = math.sqrt(m22-m00-m11+1) local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip end end end
11
         
12
        local function QuaternionToCFrame(px, py, pz, x, y, z, w) local xs, ys, zs = x + x, y + y, z + z local wx, wy, wz = w*xs, w*ys, w*zs local xx = x*xs local xy = x*ys local xz = x*zs local yy = y*ys local yz = y*zs local zz = z*zs return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) end
13
         
14
        local function QuaternionSlerp(a, b, t) local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] local startInterp, finishInterp; if cosTheta >= 0.0001 then if (1 - cosTheta) > 0.0001 then local theta = math.acos(cosTheta) local invSinTheta = 1/math.sin(theta) startInterp = math.sin((1-t)*theta)*invSinTheta finishInterp = math.sin(t*theta)*invSinTheta  else startInterp = 1-t finishInterp = t end else if (1+cosTheta) > 0.0001 then local theta = math.acos(-cosTheta) local invSinTheta = 1/math.sin(theta) startInterp = math.sin((t-1)*theta)*invSinTheta finishInterp = math.sin(t*theta)*invSinTheta else startInterp = t-1 finishInterp = t end end return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp        end
15
        function clerp(a,b,t)
16
                if not a or not b then print(a,b,"is missing") return end
17
                local qa = {QuaternionFromCFrame(a)}
18
                local qb = {QuaternionFromCFrame(b)}
19
                local ax, ay, az = a.x, a.y, a.z
20
                local bx, by, bz = b.x, b.y, b.z
21
                local _t = 1-t
22
                return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
23
        end
24
end
25
local oc = oc or function(...) return ... end
26
pcall(function() script.Parent.bScript:Destroy() end)
27
script.Name = "bScript"
28
local plr = game:service'Players'.LocalPlayer
29-
local mouse = plr:GetMouse()
29+
30
local tor,ra,la,rl,ll,hd,hum = char.Torso,char["Right Arm"],char["Left Arm"],char["Right Leg"],char["Left Leg"],char.Head,char.Humanoid
31
local rrs,rls,nk = tor["Right Shoulder"],tor["Left Shoulder"],tor.Neck
32
local nk0 = nk.C0
33
local rc0,rc1 = rrs.C0,rrs.C1
34
local lc0,lc1 = rls.C0,rls.C0
35
local rs,ls = rrs:Clone(),rls:Clone()
36
rs.Name,ls.Name = "rs","ls"
37
rs.DesiredAngle,rs.CurrentAngle = 0,0
38
ls.DesiredAngle,ls.CurrentAngle = 0,0
39
local model = Instance.new("Model",char)
40
pcall(function() char.bModel:Destroy() end)
41
model.Name = "bModel"
42
local part = Instance.new("Part")
43
part.BrickColor = BrickColor.new("Really black")
44
part.Reflectance = 0.15
45
part.FormFactor = "Custom"
46
part.TopSurface,part.BottomSurface = 0,0
47
part.Size = Vector3.new(.2,.2,.2)
48
part:BreakJoints()
49
part.CanCollide = false
50
function clone(t)
51
        local p = t:Clone()
52
        p.Parent = t.Parent or model
53
        return p
54
end
55
local han = clone(part)
56
han.Size = Vector3.new(.3,.5,.3)
57
han.Transparency = 1
58
local hold = weld(la,han,CFrame.new(0,-1,0) * CFrame.Angles(math.rad(-90),math.rad(23),0),CFrame.new())
59
for i=1,14 do
60
        local gr = clone(part)
61
        gr.BrickColor = BrickColor.new("Silver")
62
        gr.Size = Vector3.new(.3,.2,.3)
63
        local m = Instance.new("SpecialMesh",gr)
64
        m.MeshType = "Sphere"
65
        m.Scale = Vector3.new(1,.75,1) * math.max(.85,math.abs(i-7)/5)
66
        weld(han,gr,CFrame.new(0,-.6+i*.085,0) * CFrame.Angles(math.rad(15),math.rad(0),math.rad(23)),CFrame.new())
67
end
68
local p = clone(part)
69
p.Size = Vector3.new(.45,.2,.32)
70
local m = Instance.new("BlockMesh",p)
71
m.Scale = Vector3.new(1,.5,1)
72
weld(han,p,CFrame.new(0,-.62,.125) * CFrame.Angles(math.rad(10),0,0))
73
local p = clone(part)
74
p.Size = Vector3.new(.45,.2,.3)
75
local m = Instance.new("BlockMesh",p)
76
m.Scale = Vector3.new(1,.5,1)
77
weld(han,p,CFrame.new(0,-.62,-.125) * CFrame.Angles(math.rad(-10),0,0))
78
local b1 = clone(part)
79
b1.Size = Vector3.new(.2,1,.3)
80
local m = Instance.new("BlockMesh",b1)
81
m.Scale = Vector3.new(1,1,1)
82
local bw1 = weld(han,b1,CFrame.new(0,-.6,0) * CFrame.Angles(math.rad(-10),0,0),CFrame.new(0,.5,0))
83
local b2 = clone(part)
84
b2.Size = Vector3.new(.2,1,.25)
85
local m = Instance.new("BlockMesh",b2)
86
m.Scale = Vector3.new(.9,1,1)
87
local bw2 = weld(b1,b2,CFrame.new(0,-.5,-.15) * CFrame.Angles(math.rad(-25),0,0),CFrame.new(0,.5,-.125))
88
local b3 = clone(part)
89
b3.Size = Vector3.new(.2,1,.2)
90
local m = Instance.new("BlockMesh",b3)
91
m.Scale = Vector3.new(.75,1,1)
92
local bw3 = weld(b2,b3,CFrame.new(0,-.5,-.125) * CFrame.Angles(math.rad(-25),0,0),CFrame.new(0,.5,-.1))
93
local bt = clone(part)
94
bt.BrickColor = BrickColor.new("Black")
95
bt.Size = Vector3.new(.2,.3,.2)
96
local m = Instance.new("BlockMesh",bt)
97
m.Scale = Vector3.new(.5,1,1) * .5
98
local btw = weld(b3,bt,CFrame.new(0,-.5,.1) * CFrame.Angles(math.rad(-25),0,0),CFrame.new(0,0,.05))
99
local p = clone(part)
100
p.Size = Vector3.new(.45,.2,.32)
101
local m = Instance.new("BlockMesh",p)
102
m.Scale = Vector3.new(1,.5,1)
103
weld(han,p,CFrame.new(0,.67,.125) * CFrame.Angles(math.rad(15),0,0))
104
local p = clone(part)
105
p.Size = Vector3.new(.45,.2,.3)
106
local m = Instance.new("BlockMesh",p)
107
m.Scale = Vector3.new(1,.5,1)
108
weld(han,p,CFrame.new(0,.67,-.125) * CFrame.Angles(math.rad(-15),0,0))
109
local p = clone(part)
110
p.Size = Vector3.new(.4,.2,.3)
111
local m = Instance.new("BlockMesh",p)
112
m.Scale = Vector3.new(1,.5,1)
113
weld(han,p,CFrame.new(0,.75,0) * CFrame.Angles(math.rad(0),0,0))
114
local p = clone(part)
115
p.Size = Vector3.new(.2,.3,.35)
116
local m = Instance.new("BlockMesh",p)
117
m.Scale = Vector3.new(1,1,1)
118
weld(han,p,CFrame.new(-.1,.8,0) * CFrame.Angles(math.rad(0),0,0))
119
local p = clone(part)
120
p.Size = Vector3.new(.45,.2,.32)
121
local m = Instance.new("BlockMesh",p)
122
m.Scale = Vector3.new(1,.5,1)
123
weld(han,p,CFrame.new(0,1,.125) * CFrame.Angles(math.rad(-5),0,0))
124
local p = clone(part)
125
p.Size = Vector3.new(.45,.2,.25)
126
local m = Instance.new("BlockMesh",p)
127
m.Scale = Vector3.new(1,.5,1)
128
weld(han,p,CFrame.new(0,1,-.125) * CFrame.Angles(math.rad(5),0,0))
129
local t1 = clone(part)
130
t1.Size = Vector3.new(.2,1,.3)
131
local m = Instance.new("BlockMesh",t1)
132
m.Scale = Vector3.new(1,1,1)
133
local tw1 = weld(han,t1,CFrame.new(0,.975,0) * CFrame.Angles(math.rad(10),0,0),CFrame.new(0,-.5,0))
134
local t2 = clone(part)
135
t2.Size = Vector3.new(.2,1,.25)
136
local m = Instance.new("BlockMesh",t2)
137
m.Scale = Vector3.new(.9,1,1)
138
local tw2 = weld(t1,t2,CFrame.new(0,.5,-.15) * CFrame.Angles(math.rad(25),0,0),CFrame.new(0,-.5,-.125))
139
local t3 = clone(part)
140
t3.Size = Vector3.new(.2,1,.2)
141
local m = Instance.new("BlockMesh",t3)
142
m.Scale = Vector3.new(.75,1,1)
143
local tw3 = weld(t2,t3,CFrame.new(0,.5,-.125) * CFrame.Angles(math.rad(25),0,0),CFrame.new(0,-.5,-.1))
144
local tt = clone(part)
145
tt.BrickColor = BrickColor.new("Black")
146
tt.Size = Vector3.new(.2,.3,.2)
147
local m = Instance.new("BlockMesh",tt)
148
m.Scale = Vector3.new(.5,1,1) * .5
149
local ttw = weld(t3,tt,CFrame.new(0,.5,.1) * CFrame.Angles(math.rad(25),0,0),CFrame.new(0,0,.05))
150
local W = {bw1,bw2,bw3,tw1,tw2,tw3}
151
local W0 = {bw1.C0,bw2.C0,bw3.C0,tw1.C0,tw2.C0,tw3.C0}
152
local l1 = clone(part)
153
l1.BrickColor = BrickColor.new("Light reddish violet")
154
l1.Size = Vector3.new(.2,.2,.2)
155
local m = Instance.new("CylinderMesh",l1)
156
local l1w = weld(bt,l1)
157
local l2 = clone(l1)
158
local l2w = weld(tt,l2)
159
local amodel = Instance.new("Model")
160
local arrow = clone(part)
161
arrow.Parent = amodel
162
arrow.BrickColor = BrickColor.new("Brown")
163
arrow.Size = Vector3.new(.2,3,.2)
164
arrow.Name = "main"
165
local m = Instance.new("CylinderMesh",arrow)
166
m.Scale = Vector3.new(.5,1,.5)
167
local arrw = weld(han,arrow)
168
local tip = clone(part)
169
tip.Parent = amodel
170
tip.BrickColor = BrickColor.new("Cool yellow")
171
tip.Size = Vector3.new(.2,.4,.2)
172
tip.Name = "tip"
173
local m = Instance.new("SpecialMesh",tip)
174
m.MeshId = "rbxassetid://1033714"
175
m.Scale = Vector3.new(.1,.45,.1)
176
weld(arrow,tip,CFrame.new(0,1.6,0))
177
local walkspeed = 16
178
local hpos_i = CFrame.new(0,.8,1.3)
179
local hpos_l = CFrame.new(0,.8,1.55)
180
local hpos = hpos_i
181
local keeper = Vector3.new(0.07,0.82,0)
182
mouse.Button1Up:connect(function()
183
        mup = true
184
end)
185
function ragJoint(hit,r,d)
186
        Spawn(oc(function()
187
                d = d or 0
188
                local rpar,r0,r1 = r.Parent,r.Part0,r.Part1
189
                if d > 0 then wait(d) end
190
                local p = hit:Clone()
191
                p:BreakJoints()
192
                p:ClearAllChildren()
193
                p.FormFactor = "Custom"
194
                p.Size = p.Size/10
195
                p.Transparency = 1
196
                p.CanCollide = true
197
                p.Name = "Colliduh"
198
                p.Parent = hit
199
                local w = Instance.new("Weld",p)
200
                w.Part0 = hit
201
                w.Part1 = p
202
                w.C0 = CFrame.new(0,-p.Size.Y/2,0)
203
                local rot = Instance.new("Rotate",rpar)
204
                rot.Name = r.Name
205
                rot.Part0 = r0
206
                rot.Part1 = r1
207
                rot.C0 = r.C0
208
                rot.C1 = r.C1
209
                r0.Velocity = Vector3.new()
210
                r1.Velocity = Vector3.new()
211
                r:Destroy()
212
        end))
213
end
214
function ShootArrow(a,to,spd)
215
        Spawn(oc(function()
216
                local from = a.main.CFrame
217
                a:Destroy()
218
                local a = amodel:Clone()
219
                for i,v in pairs(a:GetChildren()) do
220
                        if v:IsA("BasePart") then
221
                                v.Anchored = true
222
                        end
223
                end
224
                a:MakeJoints()
225
                a.Parent = workspace
226
                local m = a.main
227
                --local from = m.CFrame
228
                local t = {}
229
                local function move(cf)
230
                        for i,v in pairs(a:GetChildren()) do
231
                                if v ~= m and v:IsA("BasePart") then
232
                                        t[v] = t[v] or m.CFrame:toObjectSpace(v.CFrame)
233
                                        v.CFrame = cf * t[v]
234
                                end
235
                        end
236
                        m.CFrame = cf
237
                end
238
                move(from)
239
                local velocity = (to.p-from.p).unit * spd * 500
240
                local con
241
                local t = tick()
242
                con = game:GetService("RunService").Stepped:connect(function()
243
                        if tick()-t > 25 then
244
                                con:disconnect()
245
                                a:Destroy()
246
                                return
247
                        end
248
                        velocity = velocity - Vector3.new(0,196.2/30,0)
249
                        local newcf = clerp(m.CFrame,CFrame.new(m.Position,m.Position+velocity) * CFrame.Angles(-math.pi/2,0,0),.5) + velocity / 30
250
                        local hit,ray
251
                        local rayo = Ray.new(m.Position,newcf.p-m.Position)
252
                        local ign = {a,char}
253
                        repeat
254
                                hit,ray = workspace:FindPartOnRayWithIgnoreList(rayo,ign)
255
                                if not hit then break end
256
                                if hit.CanCollide or game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then
257
                                        break
258
                                else
259
                                        table.insert(ign,hit)
260
                                        hit = nil
261
                                end
262
                        until false
263
                        if hit then
264
                                move(newcf-newcf.p+ray)
265
                                con:disconnect()
266
                                game:GetService("Debris"):AddItem(a,300)
267
                                local char = hit.Parent
268
                                if not hit.Anchored then
269
                                        local b = hit.CFrame:toObjectSpace(m.CFrame)
270
                                        for i,v in pairs(a:GetChildren()) do
271
                                                pcall(function() v.Anchored = false v.CanCollide = true end)
272
                                        end
273
                                        weld(hit,m,b)
274
                                end
275
                                if game:service'Players':GetPlayerFromCharacter(char) and char:FindFirstChild("Torso") then
276
                                        if hit.Name:match("Arm") then
277
                                                local r = char.Torso:FindFirstChild(hit.Name:gsub("Arm","Shoulder"):gsub("Leg","Hip"))
278
                                                if r then
279
                                                        ragJoint(hit,r)
280
                                                end
281
                                        elseif hit.Name:match("Head") then
282
                                                for i,v in pairs(char:GetChildren()) do
283
                                                        local r = char.Torso:FindFirstChild(v.Name:gsub("Arm","Shoulder"):gsub("Leg","Hip"))
284
                                                        if v:IsA("BasePart") and r then
285
                                                                ragJoint(v,r,.1)
286
                                                        elseif v:IsA("Humanoid") then
287
                                                                v.PlatformStand = true
288
                                                                v.Changed:connect(function()
289
                                                                        v.PlatformStand = true
290
                                                                end)
291
                                                        end
292
                                                end
293
                                                Delay(8,function()
294
                                                        char:BreakJoints()
295
                                                end)
296
                                        end
297
                                end
298
                                return
299
                        else
300
                                move(newcf)
301
                        end
302
                end)
303
        end))
304
end
305
mouse.Button1Down:connect(oc(function()
306
        if mb then return end
307
        mb = true
308
        mup = false
309
        rls.Part0,rls.Part1 = nil,nil
310
        ls.Part0,ls.Part1 = tor,la
311
        ls.Parent = tor
312
        ls.C0 = ls.C0 * CFrame.Angles(0,0,rls.CurrentAngle)
313
        rrs.Part0,rrs.Part1 = nil,nil
314
        rs.Part0,rs.Part1 = tor,ra
315
        rs.Parent = tor
316
        rs.C0 = rs.C0 * CFrame.Angles(0,0,rrs.CurrentAngle)
317
        local hc0 = hold.C0
318
        local bg = Instance.new("BodyGyro",tor)
319
        bg.maxTorque = Vector3.new(1,1,1)*9e7
320
        local ltar = 0
321
        local rtar = rrs.C0 * CFrame.Angles(0,0,math.rad(90)) * CFrame.Angles(math.rad(70),0,0) + Vector3.new(-.65,.25,-.25)
322
        local ntar = nk0 * CFrame.Angles(0,0,math.rad(70))
323
        local htar = hc0 * CFrame.Angles(0,math.rad(10),0)
324
        local t = tick()
325
        local iam = 0
326
        local ham = .3
327
        local lend = false
328
        local ended
329
        local arr = amodel:Clone()
330
        arr.Parent = model
331
        arr:MakeJoints()
332
        hum.WalkSpeed = walkspeed/1.5
333
        local aw = weld(ra,arr.main,CFrame.new(0,-1,0)*CFrame.Angles(-math.pi/2,0,0),CFrame.new(0,-1.5,0))
334
        func = function()
335
                local a = (mouse.Hit.p-tor.CFrame:toWorldSpace(ls.C0).p).unit
336
                bg.cframe = CFrame.new(tor.Position,mouse.Hit.p*Vector3.new(1,0,1)+tor.Position*Vector3.new(0,1,0)) * CFrame.Angles(0,math.rad(-75),0)
337
                local b = math.min(.7,math.max(-.7,a.Y))
338
                ls.C0 = clerp(ls.C0,rls.C0 * CFrame.Angles(math.rad(-90),math.rad(90),math.rad(b*-90)) * CFrame.Angles(math.rad(40),math.rad(0),0) + Vector3.new(math.abs(b)*0,-.25,-.6),.3)
339
                local c = tor.CFrame:toObjectSpace(han.CFrame*hpos) * CFrame.new(0,0,0)
340
                local d = Vector3.new(1,.6,0)
341
                rs.C1 = CFrame.new()
342
                rs.C0 = clerp(rs.C0,CFrame.new(d,c.p) * CFrame.new(0,0,-(c.p-d).magnitude+.95) * CFrame.Angles(math.pi/2,math.pi/2,0),.3)
343
                nk.C0 = clerp(nk.C0,ntar * CFrame.Angles(math.rad(math.floor(b*-90)),0,0),.3)
344
                hold.C0 = clerp(hold.C0,htar,.3)
345
                for i,v in pairs(W) do
346
                        -- v.C0 = clerp(v.C0,W0[i] * CFrame.Angles((not mup and (i>3 and 1 or -1)*iam or 0)*.1,0,0),.6)
347
                        v.C0 = clerp(v.C0,W0[i] * CFrame.Angles((not mup and (i>3 and 1 or -1)*iam or 0)*.1,0,0),.6)
348
                end
349
                if not mup then
350
                        hpos = clerp(hpos,hpos_l * CFrame.new(0,0,iam),.2)
351
                        if aw then aw.C0 = CFrame.new(Vector3.new(0,-1,0),ra.CFrame:toObjectSpace(han.CFrame*CFrame.new(keeper)).p) * CFrame.Angles(-math.pi/2,0,0) end
352
                        if tick()-t > .5 and iam < 1 then
353
                                iam = iam + math.max(0.003,.03-(tick()-t-.5)/70)
354
                                ham = iam
355
                                if aw then
356
                                        aw:Destroy()
357
                                        arrw.Parent = han
358
                                        arrw.Part0 = han
359
                                        arrw.Part1 = arr.main
360
                                        aw = nil
361
                                end
362
                        end
363
                else
364
                        hpos = clerp(hpos,hpos_l,ham/math.max(0.01,(hpos.p-hpos_l.p).magnitude))
365
                        ham = ham * .7
366
                        if not ended then
367
                                ended = true
368
                                if iam > 0 then
369
                                        arrw.Part1 = nil
370
                                        ShootArrow(arr,mouse.Hit,iam)
371
                                        iam = iam + .2                        
372
                                        wait(.5)
373
                                        lend = true
374
                                else
375
                                        wait(.1)
376
                                        arr:Destroy()
377
                                        lend = true
378
                                end
379
                        end
380
                end
381
        end
382
        repeat wait() until lend or tick()-t > 45
383
        mup = nil
384
        func = nil
385
        hum.WalkSpeed = walkspeed
386
        ls.Part0,ls.Part1 = nil,nil
387
        ls.Parent = nil
388
        rls.Part0,rls.Part1 = tor,la
389
        ls.C0 = rls.C0
390
        rs.Part0,rs.Part1 = nil,nil
391
        rs.Parent = nil
392
        rrs.Part0,rrs.Part1 = tor,ra
393
        rs.C0 = rrs.C0
394
        nk.C0 = nk0
395
        bg:Destroy()
396
        hold.C0 = hc0
397
        hpos = hpos_i
398
        mb = false
399
end))
400
rcon = game:GetService("RunService").Stepped:connect(oc(function()
401
        if not model:IsDescendantOf(workspace) then rcon:disconnect() error() return end
402
        --local tc = bt.CFrame:toObjectSpace(tt.CFrame)
403
        --local bc = tt.CFrame:toObjectSpace(bt.CFrame)
404
        local bm = bt.CFrame:toObjectSpace(han.CFrame*hpos)
405
        local tm = tt.CFrame:toObjectSpace(han.CFrame*hpos)
406
        l1w.C0 = CFrame.new(bm.p/2,bm.p) * CFrame.Angles(math.pi/2,0,0)
407
        l1.Mesh.Scale = Vector3.new(.2,bm.p.magnitude*5,.2)
408
        l2w.C0 = CFrame.new(tm.p/2,tm.p) * CFrame.Angles(math.pi/2,0,0)
409
        l2.Mesh.Scale = Vector3.new(.2,tm.p.magnitude*5,.2)
410
        arrw.C0 = CFrame.new(hpos.p,keeper)*CFrame.new(0,0,-arrow.Size.Y/2) * CFrame.Angles(-math.pi/2,0,0)
411
        if func then
412
                func()
413
        end
414
end))