SHOW:
|
|
- or go back to the newest paste.
1 | --LANCER SCRIPT BY YOUNGMACKA123.-- | |
2 | ||
3 | ||
4 | --We already have jevil, how about we have lancer?-- | |
5 | ||
6 | plr = owner | |
7 | char = plr.Character | |
8 | Character = char | |
9 | anim = char.Animate | |
10 | anim:Destroy() | |
11 | torso = char.Torso | |
12 | lefta = char["Left Arm"] | |
13 | righta = char["Right Arm"] | |
14 | leftl = char["Left Leg"] | |
15 | rightl = char["Right Leg"] | |
16 | Root=Character["HumanoidRootPart"] | |
17 | position = nil | |
18 | LeftArm=Character["Left Arm"] | |
19 | LeftLeg=Character["Left Leg"] | |
20 | RightArm=Character["Right Arm"] | |
21 | RightLeg=Character["Right Leg"] | |
22 | Root=Character["HumanoidRootPart"] | |
23 | Head=Character["Head"] | |
24 | Torso=Character["Torso"] | |
25 | Neck=Torso["Neck"] | |
26 | walking = false | |
27 | jumping = false | |
28 | attacking = false | |
29 | firsttime = false | |
30 | tauntdebounce = false | |
31 | position = nil | |
32 | MseGuide = true | |
33 | running = false | |
34 | settime = 0 | |
35 | sine = 0 | |
36 | t = 0 | |
37 | ws = 14 | |
38 | change = 1 | |
39 | combo1 = true | |
40 | dancing = false | |
41 | equip = false | |
42 | dgs = 75 | |
43 | combo2 = false | |
44 | switch1 = true | |
45 | switch2 = false | |
46 | firsttime2 = false | |
47 | combo3 = false | |
48 | RunSrv = game:GetService("RunService") | |
49 | removeuseless = game:GetService("Debris") | |
50 | ||
51 | --CREATE LANCER CHARACTER-- | |
52 | ||
53 | facetxt = "rbxassetid://2842757463" | |
54 | chesttxt = "rbxassetid://3111279416" | |
55 | ||
56 | ||
57 | spawn(function() | |
58 | while wait() do | |
59 | Head.BrickColor = BrickColor.new("Institutional white") | |
60 | RightArm.BrickColor = BrickColor.new("Institutional white") | |
61 | LeftArm.BrickColor = BrickColor.new("Institutional white") | |
62 | Torso.BrickColor = BrickColor.new("Black") | |
63 | RightLeg.BrickColor = BrickColor.new("Institutional white") | |
64 | LeftLeg.BrickColor = BrickColor.new("Institutional white") | |
65 | Head.face.Texture = facetxt | |
66 | - | local Chestplate |
66 | + | |
67 | - | Chestplate = Instance.new("Decal") |
67 | + | |
68 | - | Chestplate.Parent = Torso |
68 | + | |
69 | - | Chestplate.Texture = chesttxt |
69 | + | |
70 | - | Chestplate.Face = "Front" |
70 | + | |
71 | v:Destroy() | |
72 | end | |
73 | end | |
74 | for i,v in pairs(Character:children()) do | |
75 | if v:IsA("Accessory") then | |
76 | v:Destroy() | |
77 | end | |
78 | end | |
79 | for i,v in pairs(Character:children()) do | |
80 | if v:IsA("Hair") then | |
81 | v:Destroy() | |
82 | end | |
83 | end | |
84 | for i,v in pairs(Character:children()) do | |
85 | if v:IsA("Shirt") then | |
86 | v:Destroy() | |
87 | end | |
88 | end | |
89 | for i,v in pairs(Character:children()) do | |
90 | if v:IsA("Pants") then | |
91 | v:Destroy() | |
92 | end | |
93 | end | |
94 | for i,v in pairs(Character:children()) do | |
95 | if v:IsA("Graphic Shirt") then | |
96 | v:Destroy() | |
97 | end | |
98 | end | |
99 | for i,v in pairs(Character:children()) do | |
100 | if v:IsA("GraphicShirt") then | |
101 | v:Destroy() | |
102 | end | |
103 | end | |
104 | ||
105 | for _,v in pairs(Character:children()) do | |
106 | if v:IsA("Shirt") then | |
107 | v.ShirtTemplate = "rbxassetid://0" | |
108 | elseif v:IsA("Pants") then | |
109 | v.PantsTemplate = "rbxassetid://0" | |
110 | elseif v:IsA("ShirtGraphic") then | |
111 | v:Remove() | |
112 | wait(.1) | |
113 | Torso.roblox:Remove() | |
114 | elseif v:IsA("Accessory") then | |
115 | v:Remove() | |
116 | end | |
117 | end | |
118 | ||
119 | block1 = Instance.new("Part") | |
120 | block1.Parent = LeftArm | |
121 | block1.BrickColor = BrickColor.new("Bright blue") | |
122 | block1.CanCollide = false | |
123 | block1.Transparency = 0 | |
124 | block1.Size = Vector3.new(1.1, 1, 1.1) | |
125 | block1.TopSurface = "Smooth" | |
126 | block1.BottomSurface = "Smooth" | |
127 | wblock1 = Instance.new("Weld") | |
128 | wblock1.Parent = block1 | |
129 | wblock1.Part0 = block1 | |
130 | wblock1.Part1 = LeftArm | |
131 | wblock1.C0 = CFrame.new(0, 0.51, 0) | |
132 | ||
133 | block2 = Instance.new("Part") | |
134 | block2.Parent = RightArm | |
135 | block2.BrickColor = BrickColor.new("Bright blue") | |
136 | block2.CanCollide = false | |
137 | block2.Transparency = 0 | |
138 | block2.Size = Vector3.new(1.1, 1, 1.1) | |
139 | block2.TopSurface = "Smooth" | |
140 | block2.BottomSurface = "Smooth" | |
141 | wblock2 = Instance.new("Weld") | |
142 | wblock2.Parent = block2 | |
143 | wblock2.Part0 = block2 | |
144 | wblock2.Part1 = RightArm | |
145 | wblock2.C0 = CFrame.new(0, 0.51, 0) | |
146 | ||
147 | block3 = Instance.new("Part") | |
148 | block3.Parent = LeftLeg | |
149 | block3.BrickColor = BrickColor.new("Bright blue") | |
150 | block3.CanCollide = false | |
151 | block3.Transparency = 0 | |
152 | block3.Size = Vector3.new(1.1, 1, 1.1) | |
153 | block3.TopSurface = "Smooth" | |
154 | block3.BottomSurface = "Smooth" | |
155 | wblock3 = Instance.new("Weld") | |
156 | wblock3.Parent = block3 | |
157 | wblock3.Part0 = block3 | |
158 | wblock3.Part1 = LeftLeg | |
159 | wblock3.C0 = CFrame.new(0, 0.51, 0) | |
160 | ||
161 | block4 = Instance.new("Part") | |
162 | block4.Parent = RightLeg | |
163 | block4.BrickColor = BrickColor.new("Bright blue") | |
164 | block4.CanCollide = false | |
165 | block4.Transparency = 0 | |
166 | block4.Size = Vector3.new(1.1, 1, 1.1) | |
167 | block4.TopSurface = "Smooth" | |
168 | block4.BottomSurface = "Smooth" | |
169 | wblock4 = Instance.new("Weld") | |
170 | wblock4.Parent = block4 | |
171 | wblock4.Part0 = block4 | |
172 | wblock4.Part1 = RightLeg | |
173 | wblock4.C0 = CFrame.new(0, 0.51, 0) | |
174 | ||
175 | hat = Instance.new("Part") | |
176 | hat.Parent = Head | |
177 | hat.CanCollide = false | |
178 | hat.Size = Vector3.new(0.1, 0.1, 0.1) | |
179 | hat.BrickColor = BrickColor.new("Bright blue") | |
180 | mhat = Instance.new("SpecialMesh") | |
181 | mhat.Parent = hat | |
182 | mhat.MeshId = "rbxassetid://54924800" | |
183 | mhat.Scale = Vector3.new(1.2, 1, 1.2) | |
184 | what = Instance.new("Weld") | |
185 | what.Parent = hat | |
186 | what.Part0 = hat | |
187 | what.Part1 = Head | |
188 | what.C0 = CFrame.new(0, -0.43, -0.6) | |
189 | ||
190 | --SMOOTH WAIT-- | |
191 | ||
192 | local HEADLERP = Instance.new("ManualWeld") | |
193 | HEADLERP.Parent = Head | |
194 | HEADLERP.Part0 = Head | |
195 | HEADLERP.Part1 = Head | |
196 | HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
197 | ||
198 | local TORSOLERP = Instance.new("ManualWeld") | |
199 | TORSOLERP.Parent = Root | |
200 | TORSOLERP.Part0 = Torso | |
201 | TORSOLERP.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
202 | ||
203 | local ROOTLERP = Instance.new("ManualWeld") | |
204 | ROOTLERP.Parent = Root | |
205 | ROOTLERP.Part0 = Root | |
206 | ROOTLERP.Part1 = Torso | |
207 | ROOTLERP.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
208 | ||
209 | local RIGHTARMLERP = Instance.new("ManualWeld") | |
210 | RIGHTARMLERP.Parent = RightArm | |
211 | RIGHTARMLERP.Part0 = RightArm | |
212 | RIGHTARMLERP.Part1 = Torso | |
213 | RIGHTARMLERP.C0 = CFrame.new(-1.5, 0, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
214 | ||
215 | local LEFTARMLERP = Instance.new("ManualWeld") | |
216 | LEFTARMLERP.Parent = LeftArm | |
217 | LEFTARMLERP.Part0 = LeftArm | |
218 | LEFTARMLERP.Part1 = Torso | |
219 | LEFTARMLERP.C0 = CFrame.new(1.5, 0, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
220 | ||
221 | local RIGHTLEGLERP = Instance.new("ManualWeld") | |
222 | RIGHTLEGLERP.Parent = RightLeg | |
223 | RIGHTLEGLERP.Part0 = RightLeg | |
224 | RIGHTLEGLERP.Part1 = Torso | |
225 | RIGHTLEGLERP.C0 = CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
226 | ||
227 | local LEFTLEGLERP = Instance.new("ManualWeld") | |
228 | LEFTLEGLERP.Parent = LeftLeg | |
229 | LEFTLEGLERP.Part0 = LeftLeg | |
230 | LEFTLEGLERP.Part1 = Torso | |
231 | LEFTLEGLERP.C0 = CFrame.new(0.5, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) | |
232 | ||
233 | local function weldBetween(a, b) | |
234 | local weld = Instance.new("ManualWeld", a) | |
235 | weld.Part0 = a | |
236 | weld.Part1 = b | |
237 | weld.C0 = a.CFrame:inverse() * b.CFrame | |
238 | return weld | |
239 | end | |
240 | ||
241 | ||
242 | function ray(pos, dir, rang, ignoredesc) | |
243 | return workspace:FindPartOnRay(Ray.new(pos, dir.unit * rang), ignoredesc) | |
244 | end | |
245 | ||
246 | function swait(num) | |
247 | if num == 0 or num == nil then | |
248 | game:service("RunService").Stepped:wait(0) | |
249 | else | |
250 | for i = 0, num do | |
251 | game:service("RunService").Stepped:wait(0) | |
252 | end | |
253 | end | |
254 | end | |
255 | ||
256 | hf = ray(Root.Position,(CFrame.new(Root.Position,Root.Position+Vector3.new(0,-1,0))).lookVector,3*3,Character) | |
257 | ||
258 | --ANIMATIONS-- | |
259 | ||
260 | checks1 = coroutine.wrap(function() | |
261 | while true do | |
262 | hf = ray(Root.Position,(CFrame.new(Root.Position,Root.Position+Vector3.new(0,-1,0))).lookVector,3*3,Character) | |
263 | if Root.Velocity.y > 1 then | |
264 | position = "Jump" | |
265 | elseif Root.Velocity.y < -1 then | |
266 | position = "Falling" | |
267 | elseif Root.Velocity.Magnitude < 2 then | |
268 | position = "Idle" | |
269 | elseif Root.Velocity.Magnitude > 2 then | |
270 | position = "Walking" | |
271 | elseif Root.Velocity.Magnitude > 20 then | |
272 | position = "Running" | |
273 | else | |
274 | end | |
275 | wait() | |
276 | end | |
277 | end) | |
278 | checks1() | |
279 | ||
280 | local anims = coroutine.wrap(function() | |
281 | while true do | |
282 | settime = 0.05 | |
283 | sine = sine + change | |
284 | if position == "Jump" and attacking == false then | |
285 | change = 1 | |
286 | spin = false | |
287 | for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end | |
288 | LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) | |
289 | RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) | |
290 | LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) | |
291 | ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.2) | |
292 | LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(-3),math.rad(-4)), 0.2) | |
293 | RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.2) | |
294 | LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.2) | |
295 | elseif position == "Falling" and attacking == false then | |
296 | change = 1 | |
297 | spin = false | |
298 | for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end | |
299 | ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(15), math.rad(0), math.rad(0)), 0.15) | |
300 | LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) | |
301 | RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) | |
302 | LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) | |
303 | RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) | |
304 | LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(-4), math.rad(0)), 0.2) | |
305 | LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.94 + .02 * math.sin(sine/12),-0) * CFrame.Angles(math.rad(28 + 5 * math.sin(sine/12)),math.rad(0),math.rad(45)), 0.2) | |
306 | RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.94 + .02 * math.sin(sine/12),-0) * CFrame.Angles(math.rad(28 + 5 * math.sin(sine/12)),math.rad(0),math.rad(-45)), 0.2) | |
307 | elseif position == "Walking" and attacking == false and running == false then | |
308 | change = 1.2 | |
309 | walking = true | |
310 | spin = false | |
311 | for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end | |
312 | RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5 + Root.RotVelocity.Y / 85,.35,-.5*math.sin(sine/11)) * CFrame.Angles(math.rad(35*math.sin(sine/11)),math.rad(0*math.sin(sine/11)),math.rad(-10 + Root.RotVelocity.Y / 10, math.sin(-20 * math.sin(sine/4)))),.3) | |
313 | LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5 + Root.RotVelocity.Y / 85,.45,.5*math.sin(sine/11)) * CFrame.Angles(math.rad(-55*math.sin(sine/11)),math.rad(-5*math.sin(sine/8)),math.rad(10 + Root.RotVelocity.Y / 10, math.sin(20 * math.sin(sine/4)))),.3) | |
314 | ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.15 * 0.6*-math.sin(sine/5.5), 0) * CFrame.Angles(math.rad(10), math.rad(12 * -math.sin(sine/11)), math.rad(0) + Root.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/10))), 0.3) | |
315 | RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/11)/2.8, -0.1 + 0.1 - math.sin(sine/11)/3.4) * CFrame.Angles(math.rad(25 - 25) + -math.sin(sine/11)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0), math.cos(-15 * 25 * math.cos(sine/11))), 0.3) | |
316 | LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/11)/2.8, -0.1 + 0.1 + math.sin(sine/11)/3.4) * CFrame.Angles(math.rad(25 - 25) - -math.sin(sine/11)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) , math.cos(-15 * 25 * math.cos(sine/11))), 0.3) | |
317 | elseif position == "Idle" and attacking == false and running == false then | |
318 | change = .5 | |
319 | spin = true | |
320 | for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end | |
321 | ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0 * -math.sin(sine/12)),math.rad(0),math.rad(0)),.1) | |
322 | LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.27 + .02 * math.sin(sine/12),.20 * -math.sin(sine/12)) * CFrame.Angles(math.rad(20 * math.sin(sine/12)),math.rad(0),math.rad(10)), 0.1) | |
323 | RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.25,-.32 + 0 * math.sin(sine/12),0 * -math.sin(sine/12)) * CFrame.Angles(math.rad(0 * math.sin(sine/12)),math.rad(0),math.rad(20)), 0.1) | |
324 | RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(6 * -math.sin(sine/12)), math.rad(0), math.rad(-10)), 0.1) | |
325 | LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(6 * -math.sin(sine/12)), math.rad(0), math.rad(10)), 0.1) | |
326 | elseif position == "Running" and attacking == false then | |
327 | change = 1 | |
328 | for i,v in pairs(Torso:GetChildren()) do if v:IsA("Sound") then v:Remove() end end | |
329 | RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(0, .5, 0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), 0.3) | |
330 | LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(-1.24+.6*math.sin(sine/4)/1.4, 0.54, 0-0.8*math.sin(sine/4))*CFrame.Angles(math.rad(6+140*math.sin(sine/4)/1.2), math.rad(0), math.rad(20+70*math.sin(sine/4))), 0.3) | |
331 | LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(0,.5,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)),.3) | |
332 | ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(-20 - 0 * math.sin(sine/4)), math.rad(0 + 6 * math.sin(sine/4)), math.rad(0) + Root.RotVelocity.Y / 30, math.sin(10 * math.sin(sine/4))), 0.3) | |
333 | RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,-.2 + .5*-math.sin(sine/4)),.3) | |
334 | RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.6+0.1*math.sin(sine/4),.7*-math.sin(sine/4)) * CFrame.Angles(math.rad(15+ -50 * math.sin(sine/4)),0,0),.3) | |
335 | LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,-.2 + .5*math.sin(sine/4)),.3) | |
336 | LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.6-0.1*math.sin(sine/4),.7*math.sin(sine/4)) * CFrame.Angles(math.rad(15 + 50 * math.sin(sine/4)),0,0),.3) | |
337 | end | |
338 | swait() | |
339 | end | |
340 | end) | |
341 | anims() | |
342 | r = game:service("RunService") | |
343 | ||
344 | local damage = 0 | |
345 | - | anims() |
345 | + | |
346 | sword = script.Parent.blade | |
347 | Tool = script.Parent | |
348 | ||
349 | local damages,values,sounds = {30,45,65},{Tool.PlaySlash,Tool.PlayThrust,Tool.PlayOverhead},{Tool.Handle.SlashSound,Tool.Handle.OverheadSound,Tool.Handle.LungeSound} | |
350 | local enabledToDamage = true | |
351 | ||
352 | function blow(hit) | |
353 | if enabledToDamage == false then return end | |
354 | enabledToDamage = false | |
355 | if (hit.Parent == nil) then enabledToDamage = true return end -- happens when bullet hits sword | |
356 | local humanoid = hit.Parent:findFirstChild("Humanoid") | |
357 | local vCharacter = Tool.Parent | |
358 | local vPlayer = game.Players:playerFromCharacter(vCharacter) | |
359 | local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character | |
360 | if humanoid~=nil and humanoid ~= hum and hum ~= nil then | |
361 | -- final check, make sure sword is in-hand | |
362 | local right_arm = vCharacter:FindFirstChild("Right Arm") | |
363 | if (right_arm ~= nil) then | |
364 | local joint = right_arm:FindFirstChild("RightGrip") | |
365 | if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then | |
366 | tagHumanoid(humanoid, vPlayer) | |
367 | humanoid:TakeDamage(damage) | |
368 | wait(1) | |
369 | untagHumanoid(humanoid) | |
370 | else | |
371 | enabledToDamage = true | |
372 | end | |
373 | else | |
374 | enabledToDamage = true | |
375 | end | |
376 | else | |
377 | enabledToDamage = true | |
378 | end | |
379 | end | |
380 | ||
381 | ||
382 | function tagHumanoid(humanoid, player) | |
383 | local creator_tag = Instance.new("ObjectValue") | |
384 | creator_tag.Value = player | |
385 | creator_tag.Name = "creator" | |
386 | creator_tag.Parent = humanoid | |
387 | end | |
388 | ||
389 | function untagHumanoid(humanoid) | |
390 | if humanoid ~= nil then | |
391 | local tag = humanoid:findFirstChild("creator") | |
392 | if tag ~= nil then | |
393 | tag.Parent = nil | |
394 | end | |
395 | end | |
396 | end | |
397 | ||
398 | ||
399 | function attack() | |
400 | damage = slash_damage | |
401 | script.Parent.Handle.SlashSound:Play() | |
402 | script.Parent.PlaySlash.Value = not script.Parent.PlaySlash.Value | |
403 | end | |
404 | ||
405 | function lunge() | |
406 | damage = lunge_damage | |
407 | script.Parent.Handle.LungeSound:Play() | |
408 | script.Parent.PlayOverhead.Value = not script.Parent.PlayOverhead.Value | |
409 | force = Instance.new("BodyVelocity") | |
410 | force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80 | |
411 | force.Parent = Tool.Parent.Torso | |
412 | wait(.5) | |
413 | force.Parent = nil | |
414 | wait(.5) | |
415 | damage = slash_damage | |
416 | end | |
417 | ||
418 | ||
419 | Tool.Enabled = true | |
420 | local last_attack = 0 | |
421 | local status = 0 | |
422 | ||
423 | function onActivated() | |
424 | if not Tool.Enabled then | |
425 | return | |
426 | end | |
427 | Tool.Enabled = false | |
428 | local character = Tool.Parent; | |
429 | local humanoid = character.Humanoid | |
430 | if humanoid == nil then | |
431 | print("Humanoid not found") | |
432 | return | |
433 | end | |
434 | t = r.Stepped:wait() | |
435 | if (t - last_attack < 1.5) then | |
436 | if status == 3 then | |
437 | status = 0 | |
438 | damage = 0 | |
439 | else | |
440 | status = status + 1 | |
441 | values[status].Value = not values[status].Value | |
442 | damage = damages[status] | |
443 | sounds[status]:Play() | |
444 | enabledToDamage = true | |
445 | wait(0.5) | |
446 | enabledToDamage = false | |
447 | end | |
448 | else | |
449 | status = 0 | |
450 | damage = 0 | |
451 | end | |
452 | last_attack = t | |
453 | Tool.Enabled = true | |
454 | end | |
455 | ||
456 | function onEquipped() | |
457 | wait(1/3) | |
458 | Tool.Handle.UnsheathSound:Play() | |
459 | end | |
460 | ||
461 | Tool.Equipped:connect(onEquipped) | |
462 | script.Parent.Activated:connect(onActivated) | |
463 | connection = sword.Touched:connect(blow) |