SHOW:
|
|
- or go back to the newest paste.
1 | local Player = game.Players.localPlayer | |
2 | local Character = Player.Character | |
3 | local red = 255 | |
4 | local green = 255 | |
5 | local blue = 255 | |
6 | local Humanoid = Character.Humanoid | |
7 | local mouse = Player:GetMouse() | |
8 | local m = Instance.new("Model", Character) | |
9 | m.Name = "WeaponModel" | |
10 | local LeftArm = Character["Left Arm"] | |
11 | local RightArm = Character["Right Arm"] | |
12 | local LeftLeg = Character["Left Leg"] | |
13 | local RightLeg = Character["Right Leg"] | |
14 | local Head = Character.Head | |
15 | local Torso = Character.Torso | |
16 | local cam = game.Workspace.CurrentCamera | |
17 | local RootPart = Character.HumanoidRootPart | |
18 | local RootJoint = RootPart.RootJoint | |
19 | local equipped = false | |
20 | local attack = false | |
21 | local Anim = "Idle" | |
22 | local idle = 0 | |
23 | local attacktype = 1 | |
24 | local Torsovelocity = (RootPart.Velocity * Vector3.new(1, 0, 1)).magnitude | |
25 | local velocity = RootPart.Velocity.y | |
26 | local sine = 0 | |
27 | local change = 1 | |
28 | local grabbed = false | |
29 | local cn = CFrame.new | |
30 | local mr = math.rad | |
31 | local angles = CFrame.Angles | |
32 | local ud = UDim2.new | |
33 | local c3 = Color3.new | |
34 | local lim = 0 | |
35 | local st = 0 | |
36 | local necko = cn(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) | |
37 | local attacktype = 1 | |
38 | local ZTarget, RocketTarget = nil, nil | |
39 | local euler = CFrame.fromEulerAnglesXYZ | |
40 | function clerp(a,b,t) | |
41 | local qa = {QuaternionFromCFrame(a)} | |
42 | local qb = {QuaternionFromCFrame(b)} | |
43 | local ax, ay, az = a.x, a.y, a.z | |
44 | local bx, by, bz = b.x, b.y, b.z | |
45 | local _t = 1-t | |
46 | return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t)) | |
47 | end | |
48 | ||
49 | function QuaternionFromCFrame(cf) | |
50 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() | |
51 | local trace = m00 + m11 + m22 | |
52 | if trace > 0 then | |
53 | local s = math.sqrt(1 + trace) | |
54 | local recip = 0.5/s | |
55 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 | |
56 | else | |
57 | local i = 0 | |
58 | if m11 > m00 then | |
59 | i = 1 | |
60 | end | |
61 | if m22 > (i == 0 and m00 or m11) then | |
62 | i = 2 | |
63 | end | |
64 | if i == 0 then | |
65 | local s = math.sqrt(m00-m11-m22+1) | |
66 | local recip = 0.5/s | |
67 | return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip | |
68 | elseif i == 1 then | |
69 | local s = math.sqrt(m11-m22-m00+1) | |
70 | local recip = 0.5/s | |
71 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip | |
72 | elseif i == 2 then | |
73 | local s = math.sqrt(m22-m00-m11+1) | |
74 | local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip | |
75 | end | |
76 | end | |
77 | end | |
78 | ||
79 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
80 | local xs, ys, zs = x + x, y + y, z + z | |
81 | local wx, wy, wz = w*xs, w*ys, w*zs | |
82 | local xx = x*xs | |
83 | local xy = x*ys | |
84 | local xz = x*zs | |
85 | local yy = y*ys | |
86 | local yz = y*zs | |
87 | local zz = z*zs | |
88 | 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)) | |
89 | end | |
90 | ||
91 | function QuaternionSlerp(a, b, t) | |
92 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] | |
93 | local startInterp, finishInterp; | |
94 | if cosTheta >= 0.0001 then | |
95 | if (1 - cosTheta) > 0.0001 then | |
96 | local theta = math.acos(cosTheta) | |
97 | local invSinTheta = 1/math.sin(theta) | |
98 | startInterp = math.sin((1-t)*theta)*invSinTheta | |
99 | finishInterp = math.sin(t*theta)*invSinTheta | |
100 | else | |
101 | startInterp = 1-t | |
102 | finishInterp = t | |
103 | end | |
104 | else | |
105 | if (1+cosTheta) > 0.0001 then | |
106 | local theta = math.acos(-cosTheta) | |
107 | local invSinTheta = 1/math.sin(theta) | |
108 | startInterp = math.sin((t-1)*theta)*invSinTheta | |
109 | finishInterp = math.sin(t*theta)*invSinTheta | |
110 | else | |
111 | startInterp = t-1 | |
112 | finishInterp = t | |
113 | end | |
114 | end | |
115 | 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 | |
116 | end | |
117 | rayCast = function(Position, Direction, Range, Ignore) | |
118 | return game:service("Workspace"):FindPartOnRay(Ray.new(Position, Direction.unit * (Range or 999.999)), Ignore) | |
119 | end | |
120 | local v = game.Players.localPlayer | |
121 | local torso = v.Character.Torso | |
122 | wait(1) | |
123 | local p = Instance.new("Part", v.Character) | |
124 | p.Name = "kit" | |
125 | p.Anchored = true | |
126 | p.Transparency = 0 | |
127 | p.Material = "Plastic" | |
128 | p.CanCollide = false | |
129 | p.TopSurface = 0 | |
130 | p.BottomSurface = 0 | |
131 | p.Size = Vector3.new(0.2, 0.2, 0.2) | |
132 | p.CustomPhysicalProperties = PhysicalProperties.new(0.01, 0, 0, 0, 0) | |
133 | local msh = Instance.new("SpecialMesh", p) | |
134 | msh.Scale = Vector3.new(-2, 2, 2) | |
135 | msh.MeshId = "http://www.roblox.com/asset/?id=188635159" | |
136 | msh.TextureId = "http://www.roblox.com/asset/?id=188539332" | |
137 | msh.VertexColor = Vector3.new(torso.BrickColor.r, torso.BrickColor.g, torso.BrickColor.b) | |
138 | local pn = Instance.new("Part", v.Character.kit) | |
139 | pn.Name = "tail" | |
140 | pn.Anchored = true | |
141 | pn.Transparency = 0 | |
142 | pn.Material = "Plastic" | |
143 | pn.CanCollide = false | |
144 | pn.TopSurface = 0 | |
145 | pn.BottomSurface = 0 | |
146 | pn.Size = Vector3.new(5, 3, 3) | |
147 | pn.CustomPhysicalProperties = PhysicalProperties.new(0.01, 0, 0, 0, 0) | |
148 | local mshn = Instance.new("SpecialMesh", pn) | |
149 | mshn.Scale = Vector3.new(2, 2, 2) | |
150 | mshn.MeshId = "http://www.roblox.com/asset/?id=188635159" | |
151 | mshn.TextureId = "http://www.roblox.com/asset/?id=188539332" | |
152 | mshn.VertexColor = Vector3.new(torso.BrickColor.r, torso.BrickColor.g, torso.BrickColor.b) | |
153 | - | local pn3 = Instance.new("Part", v.Character.kit) |
153 | + | local pn3 = Instance.new("Part", v.Character.kit) |