SHOW:
|
|
- or go back to the newest paste.
1 | Tool0 = Instance.new("Tool") | |
2 | Part1 = Instance.new("Part") | |
3 | SpecialMesh2 = Instance.new("SpecialMesh") | |
4 | Sound3 = Instance.new("Sound") | |
5 | Sound4 = Instance.new("Sound") | |
6 | Sound5 = Instance.new("Sound") | |
7 | Tool0.Name = "Blood Sword" | |
8 | Tool0.Parent = owner['Backpack'] | |
9 | Tool0.TextureId = "rbxasset://Textures/Sword128.png" | |
10 | Tool0.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0) | |
11 | Tool0.GripForward = Vector3.new(-1, -0, -0) | |
12 | Tool0.GripPos = Vector3.new(0, 0, -1.5) | |
13 | Tool0.GripRight = Vector3.new(0, 1, 0) | |
14 | Tool0.GripUp = Vector3.new(0, 0, 1) | |
15 | Part1.Name = "Handle" | |
16 | Part1.Parent = Tool0 | |
17 | Part1.CFrame = CFrame.new(-3.43658304, 5.1203289, 3.84549809, 0.0910440385, -0.881099463, 0.464084357, 0.537011683, 0.435894847, 0.722229123, -0.838648558, 0.183463722, 0.512845576) | |
18 | Part1.Color = Color3.new(0.462745, 0, 0) | |
19 | Part1.Size = Vector3.new(1, 0.800000012, 4) | |
20 | Part1.Locked = true | |
21 | Part1.Material = Enum.Material.SmoothPlastic | |
22 | SpecialMesh2.Parent = Part1 | |
23 | SpecialMesh2.MeshId = "rbxasset://fonts/sword.mesh" | |
24 | SpecialMesh2.MeshType = Enum.MeshType.FileMesh | |
25 | Sound3.Name = "SwordSlash" | |
26 | Sound3.Parent = Part1 | |
27 | Sound3.SoundId = "http://www.roblox.com/asset/?id=12222216" | |
28 | Sound3.Volume = 0.69999998807907 | |
29 | Sound4.Name = "SwordLunge" | |
30 | Sound4.Parent = Part1 | |
31 | Sound4.SoundId = "http://www.roblox.com/asset/?id=12222208" | |
32 | Sound4.Volume = 0.60000002384186 | |
33 | Sound5.Name = "Unsheath" | |
34 | Sound5.Parent = Part1 | |
35 | Sound5.SoundId = "http://www.roblox.com/asset/?id=12222225" | |
36 | Sound5.Volume = 1 | |
37 | ||
38 | Tool = Tool0 | |
39 | Handle = Tool:WaitForChild("Handle") | |
40 | ||
41 | function Create(ty) | |
42 | return function(data) | |
43 | local obj = Instance.new(ty) | |
44 | for k, v in pairs(data) do | |
45 | if type(k) == 'number' then | |
46 | v.Parent = obj | |
47 | else | |
48 | obj[k] = v | |
49 | end | |
50 | end | |
51 | return obj | |
52 | end | |
53 | end | |
54 | ||
55 | local BaseUrl = "rbxassetid://" | |
56 | ||
57 | Players = game:GetService("Players") | |
58 | Debris = game:GetService("Debris") | |
59 | RunService = game:GetService("RunService") | |
60 | ||
61 | - | local SlashDamage = 10 |
61 | + | local SlashDamage = 100 |
62 | - | local LungeDamage = 20 |
62 | + | local LungeDamage = 100 |
63 | local Damage = SlashDamage | |
64 | ||
65 | --For R15 avatars | |
66 | Animations = { | |
67 | R15Slash = 522635514, | |
68 | R15Lunge = 522638767 | |
69 | } | |
70 | ||
71 | Grips = { | |
72 | Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0), | |
73 | Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1) | |
74 | } | |
75 | ||
76 | Sounds = { | |
77 | Slash = Handle:WaitForChild("SwordSlash"), | |
78 | Lunge = Handle:WaitForChild("SwordLunge"), | |
79 | Unsheath = Handle:WaitForChild("Unsheath") | |
80 | } | |
81 | ||
82 | ToolEquipped = false | |
83 | ||
84 | Tool.Grip = Grips.Up | |
85 | Tool.Enabled = true | |
86 | ||
87 | function TagHumanoid(humanoid, player) | |
88 | local Creator_Tag = Instance.new("ObjectValue") | |
89 | Creator_Tag.Name = "creator" | |
90 | Creator_Tag.Value = player | |
91 | Debris:AddItem(Creator_Tag, 2) | |
92 | Creator_Tag.Parent = humanoid | |
93 | end | |
94 | ||
95 | function UntagHumanoid(humanoid) | |
96 | for i, v in pairs(humanoid:GetChildren()) do | |
97 | if v:IsA("ObjectValue") and v.Name == "creator" then | |
98 | v:Destroy() | |
99 | end | |
100 | end | |
101 | end | |
102 | ||
103 | local junk = Instance.new("Folder",script) | |
104 | local junk2 = Instance.new("Folder",script) | |
105 | local chars = {} | |
106 | local sfx = { | |
107 | cry_pain = {4534200393,4534197713,4534199297,4534199744,4534197529,4534197880,4534198897}, | |
108 | stabs = {6330987744,6330987902,6330988021,6330988145}, | |
109 | } | |
110 | ||
111 | function raycast(Pos, Dir, Max, Ignore) | |
112 | local rayparams = RaycastParams.new() | |
113 | rayparams.FilterType = Enum.RaycastFilterType.Blacklist | |
114 | rayparams.FilterDescendantsInstances = Ignore | |
115 | rayparams.IgnoreWater = true | |
116 | return workspace:Raycast(Pos, Dir * (Max or 999.999), rayparams) | |
117 | end | |
118 | ||
119 | function raycast2(Pos, Dir, Max, whitelist) | |
120 | local rayparams = RaycastParams.new() | |
121 | rayparams.FilterType = Enum.RaycastFilterType.Whitelist | |
122 | rayparams.FilterDescendantsInstances = whitelist | |
123 | rayparams.IgnoreWater = true | |
124 | return workspace:Raycast(Pos, Dir * (Max or 999.999), rayparams) | |
125 | end | |
126 | ||
127 | coroutine.wrap(function() | |
128 | for i,v in pairs(workspace:GetChildren()) do | |
129 | if v:FindFirstChildOfClass("Humanoid") then | |
130 | table.insert(chars,1,v) | |
131 | end | |
132 | end | |
133 | workspace.ChildAdded:Connect(function(v) | |
134 | game:GetService("RunService").Heartbeat:Wait() | |
135 | if v:FindFirstChildOfClass("Humanoid") then | |
136 | table.insert(chars,1,v) | |
137 | end | |
138 | end) | |
139 | end)() | |
140 | ||
141 | function cast_blood(targchar,obj,lastpos,dir,ignore,count) | |
142 | ignore = ignore or {targchar,chars,junk} | |
143 | count = count or 1 | |
144 | if count >= 3 then return end | |
145 | local blood = nil | |
146 | local s = lastpos | |
147 | local dist = math.clamp((obj.Position-lastpos).Magnitude,7,1000) | |
148 | dir = dir.Unit | |
149 | local result = raycast(s,dir,dist,ignore) | |
150 | if result and not blood then | |
151 | local ob,pos,norm = result.Instance,result.Position,result.Normal | |
152 | local char = ob:FindFirstAncestorOfClass('Model') | |
153 | local hum = nil | |
154 | if char then | |
155 | hum = char:FindFirstChildOfClass('Humanoid') | |
156 | end | |
157 | if not hum and 1 > ob.Transparency then else | |
158 | --table.insert(ignore,1,ob) | |
159 | --cast_blood(targchar,obj,dir,ignore,count) | |
160 | return | |
161 | end | |
162 | local m = 1+math.random() | |
163 | if ob.Name == 'blood' then | |
164 | blood = ob | |
165 | local newsize = blood.Size+Vector3.new(0.1*m,0,0.1*m) | |
166 | if newsize.X >= 10 then | |
167 | newsize = Vector3.new(10,0.1,10) | |
168 | end | |
169 | local rs = newsize.X | |
170 | newsize = Vector3.new(rs,0.1,rs) | |
171 | blood.Size = newsize | |
172 | return true | |
173 | end | |
174 | blood = Instance.new("Part") | |
175 | blood.Name = 'blood' | |
176 | blood.Color = Color3.fromRGB(117,0,0) | |
177 | blood.Material = Enum.Material.Glass | |
178 | blood.Transparency = 1 | |
179 | blood.Anchored = true | |
180 | blood.CanCollide = false | |
181 | blood.CastShadow = false | |
182 | blood.Size = Vector3.new() | |
183 | blood.CFrame = CFrame.new(pos,pos+norm)*CFrame.Angles(math.rad(90),0,0) | |
184 | blood.Parent = junk2 | |
185 | ||
186 | local newsize = Vector3.new(1*m,0.1,1*m) | |
187 | local rs = newsize.X --restrict_size(newsize,ob.Size,norm) | |
188 | newsize = Vector3.new(rs,0.1,rs) | |
189 | game:GetService("TweenService"):Create(blood,TweenInfo.new(0.5),{ | |
190 | Transparency = 0, | |
191 | Size = newsize, | |
192 | }):Play() | |
193 | local hval = Instance.new("ObjectValue") | |
194 | hval.Name = 'hit' | |
195 | hval.Value = ob | |
196 | hval.Parent = blood | |
197 | local mesh = Instance.new("SpecialMesh") | |
198 | mesh.MeshType = Enum.MeshType.Sphere | |
199 | mesh.Parent = blood | |
200 | if _G['lfx'] then | |
201 | game:GetService("Debris"):AddItem(blood,5) | |
202 | else | |
203 | game:GetService("Debris"):AddItem(blood,10) | |
204 | end | |
205 | return true | |
206 | end | |
207 | end | |
208 | ||
209 | local bdata = {} | |
210 | ||
211 | function createblood(obj,dur,dir,start) | |
212 | coroutine.wrap(function() | |
213 | if obj.Name ~= 'HumanoidRootPart' then else return end | |
214 | local targchar = obj.Parent | |
215 | local targhum = targchar:FindFirstChildOfClass('Humanoid') | |
216 | if not bdata[obj] then | |
217 | bdata[obj] = {dur,dir} | |
218 | else | |
219 | bdata[obj][1] += dur | |
220 | bdata[obj][2] = dir | |
221 | return | |
222 | end | |
223 | local st = os.clock() | |
224 | while true do | |
225 | if bdata[obj][1] >= os.clock()-st and obj and obj.Parent and targchar and targchar.Parent then else | |
226 | break | |
227 | end | |
228 | coroutine.wrap(function() | |
229 | local drop = Instance.new("Part") | |
230 | drop.Anchored = false | |
231 | drop.CanCollide = false | |
232 | drop.Massless = true | |
233 | drop.CastShadow = false | |
234 | drop.CFrame = obj.CFrame--*start | |
235 | drop.Size = Vector3.new(0.2,0.2,0.2) | |
236 | drop.Shape = Enum.PartType.Ball | |
237 | drop.Color = Color3.new(0.454902, 0, 0) | |
238 | drop.Material = Enum.Material.Glass | |
239 | drop.Velocity = dir*10+Vector3.new(math.random()*2-1,math.random()*2-1,math.random()*2-1)*10 | |
240 | local att1,att2 = Instance.new("Attachment",drop),Instance.new("Attachment",drop) | |
241 | att1.Position = Vector3.new(0,drop.Size.Y/2,0) | |
242 | att2.Position = Vector3.new(0,-drop.Size.Y/2,0) | |
243 | local trail = Instance.new("Trail") | |
244 | trail.Attachment0 = att1 | |
245 | trail.Attachment1 = att2 | |
246 | trail.Transparency = NumberSequence.new(0,1) | |
247 | trail.MinLength = 0.1 | |
248 | trail.Lifetime = 0.2 | |
249 | trail.Color = ColorSequence.new(Color3.new(0.454902, 0, 0),Color3.new(0.454902, 0, 0)) | |
250 | trail.Parent = drop | |
251 | ||
252 | local lastpos = drop.Position | |
253 | drop.Parent = junk | |
254 | game:GetService("Debris"):AddItem(drop,5) | |
255 | local hit = false | |
256 | while not hit and drop and drop.Parent and obj do | |
257 | local st = os.clock() | |
258 | repeat | |
259 | game:GetService("RunService").Stepped:Wait() | |
260 | until os.clock()-st >= 0.2 | |
261 | local d = drop.Velocity | |
262 | hit = cast_blood(targchar,obj,lastpos,d) | |
263 | lastpos = drop.Position | |
264 | end | |
265 | if drop then | |
266 | drop:Destroy() | |
267 | end | |
268 | end)() | |
269 | wait(0.1) | |
270 | end | |
271 | end)() | |
272 | end | |
273 | ||
274 | function check_knock(char,hum) | |
275 | if 15 > hum.Health and hum.Health > 0 then | |
276 | --ragdoll(char,false) | |
277 | end | |
278 | end | |
279 | ||
280 | function is_god(char) | |
281 | local ff = char:FindFirstChildOfClass("ForceField") | |
282 | local hum = char:FindFirstChildOfClass("Humanoid") | |
283 | if ff then | |
284 | return true | |
285 | elseif hum and hum.MaxHealth >= 1/0 then | |
286 | return true | |
287 | end | |
288 | end | |
289 | ||
290 | function bleed(obj,dur,dir,start,can_hurt,visible) | |
291 | if visible == nil then | |
292 | visible = true | |
293 | end | |
294 | local char = obj.Parent | |
295 | local hum = char:FindFirstChildOfClass('Humanoid') | |
296 | if visible then | |
297 | createblood(obj,dur,dir,start) | |
298 | end | |
299 | if can_hurt then | |
300 | local groan = Instance.new("Sound") | |
301 | groan.SoundId = 'rbxassetid://' .. sfx.cry_pain[math.random(1,#sfx.cry_pain)] | |
302 | groan.Volume = 0.5 | |
303 | groan.Parent = obj | |
304 | groan:Play() | |
305 | game:GetService("Debris"):AddItem(groan,1) | |
306 | coroutine.wrap(function() | |
307 | local st = os.clock() | |
308 | while dur >= os.clock()-st do | |
309 | if hum and not is_god(char) then | |
310 | local dmg = 1 | |
311 | if 0 >= hum.Health-dmg then | |
312 | --ragdoll(char,true) | |
313 | end | |
314 | hum:TakeDamage(dmg) | |
315 | check_knock(char,hum) | |
316 | end | |
317 | wait(0.1) | |
318 | end | |
319 | end)() | |
320 | end | |
321 | end | |
322 | ||
323 | function raycastdepth(targchar, org, dir, ignore, attempt) | |
324 | ignore = ignore or {} | |
325 | attempt = attempt or 1 | |
326 | ||
327 | local parts = {} | |
328 | for i,v in pairs(targchar:GetChildren()) do | |
329 | if v:IsA("BasePart") and (v.Name == 'Head' or v.Name == 'HumanoidRootPart') then | |
330 | table.insert(parts,v) | |
331 | end | |
332 | end | |
333 | --[[ | |
334 | for i,v in pairs(targchar:GetChildren()) do | |
335 | if v:IsA("BasePart") and v.Name ~= 'Head' and v.Name ~= 'HumanoidRootPart' then | |
336 | table.insert(parts,v) | |
337 | end | |
338 | end | |
339 | local result = raycast2(org, dir, nil, {unpack(parts)}) | |
340 | ]] | |
341 | local chars2 = chars | |
342 | table.remove(chars2,table.find(chars2,targchar)) | |
343 | local result = raycast(org, dir, nil, {chars2,parts,junk}) | |
344 | local hit,pos,norm | |
345 | if result then | |
346 | hit,pos,norm = result.Instance,result.Position,result.Normal | |
347 | end | |
348 | if result and hit.Parent == targchar then | |
349 | local diagonalLength = hit.Size.Magnitude | |
350 | local reverseLook = -dir.Unit | |
351 | local dir2 = reverseLook*diagonalLength | |
352 | local org2 = pos - dir2 | |
353 | local result = raycast2(org2, dir2, nil,{hit}) | |
354 | local hit2,pos2,norm2 | |
355 | local depth = 0 | |
356 | if result then | |
357 | hit2,pos2,norm2 = result.Instance,result.Position,result.Normal | |
358 | depth = (pos2-pos).Magnitude | |
359 | end | |
360 | ||
361 | return hit,pos,norm,hit2,pos2,norm2,depth | |
362 | else | |
363 | if attempt >= 2 or not result then | |
364 | return hit,pos,norm | |
365 | else | |
366 | raycastdepth(targchar, org, dir, {hit,unpack(ignore)}, attempt+1) | |
367 | end | |
368 | end | |
369 | end | |
370 | ||
371 | function blood_tissue(targchar,org,dir,lpart,lpart2) | |
372 | local hit,pos,norm,hit2,pos2,norm2,depth = raycastdepth(targchar,org,dir.Unit) | |
373 | local par = junk --targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart") | |
374 | if hit and hit2 and par then else return end | |
375 | local w = 0.1 | |
376 | local lp,lp2 | |
377 | pcall(function() | |
378 | local clot = Instance.new("Part") | |
379 | clot.BrickColor = BrickColor.new("Maroon") | |
380 | clot.Material = Enum.Material.SmoothPlastic | |
381 | clot.Massless = true | |
382 | clot.Anchored = false | |
383 | clot.CanCollide = false | |
384 | clot.Shape = Enum.PartType.Ball | |
385 | clot.Size = Vector3.new(w,0.1,w) | |
386 | clot.CFrame = CFrame.new(pos,pos+norm)*CFrame.Angles(math.rad(90),0,0) | |
387 | clot.Parent = par | |
388 | local weld = Instance.new("Weld") | |
389 | weld.Part0 = hit | |
390 | weld.Part1 = clot | |
391 | weld.C0 = weld.Part0.CFrame:Inverse() | |
392 | weld.C1 = weld.Part1.CFrame:Inverse() | |
393 | weld.Parent = clot | |
394 | if lpart then | |
395 | local rod = Instance.new("RodConstraint") | |
396 | rod.Attachment0 = Instance.new("Attachment",lpart) | |
397 | rod.Attachment1 = Instance.new("Attachment",clot) | |
398 | rod.Visible = true | |
399 | rod.Thickness = w | |
400 | rod.Color = clot.BrickColor | |
401 | rod.Parent = clot | |
402 | end | |
403 | lp = clot | |
404 | game:GetService("Debris"):AddItem(clot,10) | |
405 | end) | |
406 | pcall(function() | |
407 | local clot = Instance.new("Part") | |
408 | clot.BrickColor = BrickColor.new("Maroon") | |
409 | clot.Material = Enum.Material.SmoothPlastic | |
410 | clot.Massless = true | |
411 | clot.Anchored = false | |
412 | clot.CanCollide = false | |
413 | clot.Shape = Enum.PartType.Ball | |
414 | clot.Size = Vector3.new(w,0.1,w) | |
415 | clot.CFrame = CFrame.new(pos2,pos2+norm2)*CFrame.Angles(math.rad(90),0,0) | |
416 | clot.Parent = par | |
417 | local weld = Instance.new("Weld") | |
418 | weld.Part0 = hit2 | |
419 | weld.Part1 = clot | |
420 | weld.C0 = weld.Part0.CFrame:Inverse() | |
421 | weld.C1 = weld.Part1.CFrame:Inverse() | |
422 | weld.Parent = clot | |
423 | if lpart2 then | |
424 | local rod = Instance.new("RodConstraint") | |
425 | rod.Attachment0 = Instance.new("Attachment",lpart2) | |
426 | rod.Attachment1 = Instance.new("Attachment",clot) | |
427 | rod.Visible = true | |
428 | rod.Thickness = w | |
429 | rod.Color = clot.BrickColor | |
430 | rod.Parent = clot | |
431 | end | |
432 | lp2 = clot | |
433 | game:GetService("Debris"):AddItem(clot,10) | |
434 | end) | |
435 | return lp,lp2 | |
436 | end | |
437 | ||
438 | local lastattack = os.clock() | |
439 | local max_attack_time = 0.5 | |
440 | ||
441 | function Blow(obj) | |
442 | if max_attack_time > os.clock()-lastattack then else return end | |
443 | if not obj or not obj.Parent or not CheckIfAlive() or not ToolEquipped then | |
444 | return | |
445 | end | |
446 | local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand") | |
447 | if not RightArm then | |
448 | return | |
449 | end | |
450 | local RightGrip = RightArm:FindFirstChild("RightGrip") | |
451 | if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then | |
452 | return | |
453 | end | |
454 | local targchar = obj.Parent | |
455 | if targchar then | |
456 | local targtorso = targchar:FindFirstChild("Torso") or targchar:FindFirstChild("HumanoidRootPart") | |
457 | local targhum = targchar:FindFirstChildOfClass("Humanoid") | |
458 | local targplr = game:GetService("Players"):GetPlayerFromCharacter(targchar) | |
459 | if targhum and targhum.Health > 0 then | |
460 | local cval = targhum:FindFirstChild("blood sword" .. plr.Name) | |
461 | if cval then return end | |
462 | cval = Instance.new("StringValue") | |
463 | cval.Name = "blood sword" .. plr.Name | |
464 | cval.Parent = targhum | |
465 | game:GetService("Debris"):AddItem(cval,0.4) | |
466 | UntagHumanoid(targhum) | |
467 | TagHumanoid(targhum,plr) | |
468 | targhum:TakeDamage(Damage) | |
469 | local s = Instance.new("Sound") | |
470 | s.SoundId = 'rbxassetid://' .. sfx.stabs[math.random(#sfx.stabs)] | |
471 | s.PlaybackSpeed = math.random(90,110)/100 | |
472 | s.Volume = 0.5 | |
473 | s.Parent = obj | |
474 | s:Play() | |
475 | game:GetService("Debris"):AddItem(s,2) | |
476 | local start = targtorso.CFrame:ToObjectSpace(Handle.CFrame) | |
477 | local dir = (targtorso.Position-torso.Position) | |
478 | coroutine.wrap(function() | |
479 | local n = 0.1 | |
480 | local lpart,lpart2 | |
481 | for i = 0,max_attack_time,n do | |
482 | local pos = Handle.Position | |
483 | local lp,lp2 = blood_tissue(targchar,pos,(obj.Position-pos),lpart,lpart2) | |
484 | if lp then | |
485 | lpart = lp | |
486 | end | |
487 | if lp2 then | |
488 | lpart2 = lp2 | |
489 | end | |
490 | wait(n) | |
491 | end | |
492 | end)() | |
493 | coroutine.wrap(function() | |
494 | bleed(obj,Damage/targhum.MaxHealth*15,dir,start,false,true) | |
495 | end)() | |
496 | end | |
497 | end | |
498 | end | |
499 | ||
500 | function Attack() | |
501 | Damage = SlashDamage | |
502 | Sounds.Slash:Play() | |
503 | if Humanoid then | |
504 | if Humanoid.RigType == Enum.HumanoidRigType.R6 then | |
505 | local Anim = Instance.new("StringValue") | |
506 | Anim.Name = "toolanim" | |
507 | Anim.Value = "Slash" | |
508 | Anim.Parent = Tool | |
509 | elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then | |
510 | local Anim = Tool:FindFirstChild("R15Slash") | |
511 | if Anim then | |
512 | local Track = Humanoid:LoadAnimation(Anim) | |
513 | Track:Play(0) | |
514 | end | |
515 | end | |
516 | end | |
517 | end | |
518 | ||
519 | function Lunge() | |
520 | Damage = LungeDamage | |
521 | Sounds.Lunge:Play() | |
522 | if Humanoid then | |
523 | if Humanoid.RigType == Enum.HumanoidRigType.R6 then | |
524 | local Anim = Instance.new("StringValue") | |
525 | Anim.Name = "toolanim" | |
526 | Anim.Value = "Lunge" | |
527 | Anim.Parent = Tool | |
528 | elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then | |
529 | local Anim = Tool:FindFirstChild("R15Lunge") | |
530 | if Anim then | |
531 | local Track = Humanoid:LoadAnimation(Anim) | |
532 | Track:Play(0) | |
533 | end | |
534 | end | |
535 | end | |
536 | wait(0.2) | |
537 | Tool.Grip = Grips.Out | |
538 | wait(0.6) | |
539 | Tool.Grip = Grips.Up | |
540 | Damage = SlashDamage | |
541 | end | |
542 | ||
543 | Tool.Enabled = true | |
544 | ||
545 | function Activated() | |
546 | if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then | |
547 | return | |
548 | end | |
549 | Tool.Enabled = false | |
550 | local Tick = os.clock() | |
551 | if (0.2 > Tick-lastattack) then | |
552 | Lunge() | |
553 | else | |
554 | Attack() | |
555 | end | |
556 | lastattack = os.clock() | |
557 | --wait(0.5) | |
558 | Damage = SlashDamage | |
559 | local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){ | |
560 | Name = "R15Slash", | |
561 | AnimationId = BaseUrl .. Animations.R15Slash, | |
562 | Parent = Tool | |
563 | }) | |
564 | ||
565 | local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){ | |
566 | Name = "R15Lunge", | |
567 | AnimationId = BaseUrl .. Animations.R15Lunge, | |
568 | Parent = Tool | |
569 | }) | |
570 | Tool.Enabled = true | |
571 | end | |
572 | ||
573 | function CheckIfAlive() | |
574 | return (((plr and plr.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and torso and torso.Parent) and true) or false) | |
575 | end | |
576 | ||
577 | function Equipped() | |
578 | Character = Tool.Parent | |
579 | plr = game:GetService("Players"):GetPlayerFromCharacter(Character) | |
580 | Humanoid = Character:FindFirstChildOfClass("Humanoid") | |
581 | torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart") | |
582 | if not CheckIfAlive() then | |
583 | return | |
584 | end | |
585 | ToolEquipped = true | |
586 | Sounds.Unsheath:Play() | |
587 | end | |
588 | ||
589 | function Unequipped() | |
590 | Tool.Grip = Grips.Up | |
591 | ToolEquipped = false | |
592 | end | |
593 | ||
594 | Tool.Activated:Connect(Activated) | |
595 | Tool.Equipped:Connect(Equipped) | |
596 | Tool.Unequipped:Connect(Unequipped) | |
597 | Connection = Handle.Touched:Connect(Blow) |