SHOW:
|
|
- or go back to the newest paste.
1 | - | |
1 | + | |
2 | equip = false | |
3 | char = Instance.new("Model",script) | |
4 | char.Name = plr.Name .." Sword" | |
5 | tool = Instance.new("Tool",nil) | |
6 | tool.Name = plr.Name .." Sword" | |
7 | tool.GripForward = Vector3.new(-1, 0, 0) | |
8 | tool.GripPos = Vector3.new(0, 0, -1.5) | |
9 | tool.GripRight = Vector3.new(0, 1, 0) | |
10 | tool.GripUp = Vector3.new(0, 0, 1) | |
11 | dmg = 0 | |
12 | Animations = { | |
13 | R15Slash = 522635514, | |
14 | R15Lunge = 522638767 | |
15 | } | |
16 | Grips = { | |
17 | Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0), | |
18 | Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1) | |
19 | } | |
20 | function Create(ty) | |
21 | return function(data) | |
22 | local obj = Instance.new(ty) | |
23 | for k, v in pairs(data) do | |
24 | if type(k) == 'number' then | |
25 | v.Parent = obj | |
26 | else | |
27 | obj[k] = v | |
28 | end | |
29 | end | |
30 | return obj | |
31 | end | |
32 | end | |
33 | BaseUrl = "rbxassetid://" | |
34 | function attack() | |
35 | local Humanoid = tool.Parent:FindFirstChildOfClass("Humanoid") | |
36 | dmg = 100 | |
37 | - | dmg = 5 |
37 | + | |
38 | if Humanoid then | |
39 | if Humanoid.RigType == Enum.HumanoidRigType.R6 then | |
40 | local Anim = Instance.new("StringValue") | |
41 | Anim.Name = "toolanim" | |
42 | Anim.Value = "Slash" | |
43 | Anim.Parent = tool | |
44 | elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then | |
45 | local Anim = tool:FindFirstChild("R15Slash") | |
46 | if Anim then | |
47 | local Track = Humanoid:LoadAnimation(Anim) | |
48 | Track:Play(0) | |
49 | end | |
50 | end | |
51 | end | |
52 | wait(.5) | |
53 | dmg = 0 | |
54 | end | |
55 | function lunge() | |
56 | local Humanoid = tool.Parent:FindFirstChildOfClass("Humanoid") | |
57 | dmg = 100 | |
58 | - | dmg = 20 |
58 | + | |
59 | if Humanoid then | |
60 | if Humanoid.RigType == Enum.HumanoidRigType.R6 then | |
61 | local Anim = Instance.new("StringValue") | |
62 | Anim.Name = "toolanim" | |
63 | Anim.Value = "Lunge" | |
64 | Anim.Parent = tool | |
65 | elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then | |
66 | local Anim = tool:FindFirstChild("R15Lunge") | |
67 | if Anim then | |
68 | local Track = Humanoid:LoadAnimation(Anim) | |
69 | Track:Play(0) | |
70 | end | |
71 | end | |
72 | end | |
73 | wait(0.2) | |
74 | tool.Grip = Grips.Out | |
75 | wait(0.6) | |
76 | tool.Grip = Grips.Up | |
77 | dmg = 0 | |
78 | end | |
79 | LastAttack = 0 | |
80 | tool.Activated:connect(function() | |
81 | local Tick = game:GetService("RunService").Stepped:wait() | |
82 | tool.Enabled = false | |
83 | if (Tick - LastAttack < 0.2) then | |
84 | lunge() | |
85 | else | |
86 | attack() | |
87 | end | |
88 | LastAttack = Tick | |
89 | local SlashAnim = (tool:FindFirstChild("R15Slash") or Create("Animation"){ | |
90 | Name = "R15Slash", | |
91 | AnimationId = BaseUrl .. Animations.R15Slash, | |
92 | Parent = tool | |
93 | }) | |
94 | ||
95 | local LungeAnim = (tool:FindFirstChild("R15Lunge") or Create("Animation"){ | |
96 | Name = "R15Lunge", | |
97 | AnimationId = BaseUrl .. Animations.R15Lunge, | |
98 | Parent = tool | |
99 | }) | |
100 | dmg = 0 | |
101 | tool.Enabled = true | |
102 | end) | |
103 | face = plr.Character.Head:FindFirstChild("face") | |
104 | if face then | |
105 | tool.TextureId = face.Texture | |
106 | end | |
107 | main = Instance.new("Part",char) | |
108 | main.Size = Vector3.new(2.5, 4, 1) | |
109 | main.BrickColor = plr.Character.Head.BrickColor | |
110 | main.Material = "Plastic" | |
111 | main.Name = "Handle" | |
112 | main.Size = Vector3.new(1, 0.8, 4) | |
113 | main.Position = plr.Character.Head.Position | |
114 | main.Touched:connect(function(hit) | |
115 | local nub = hit.Parent | |
116 | for _,v in pairs (nub:children()) do | |
117 | if v:IsA("Humanoid") then | |
118 | v.Health = v.Health - dmg | |
119 | end | |
120 | end | |
121 | end) | |
122 | newface = Instance.new("Decal",main) | |
123 | if face then | |
124 | newface.Texture = face.Texture | |
125 | end | |
126 | newface.Face = "Back" | |
127 | detect = Instance.new("ClickDetector",main) | |
128 | detect.MaxActivationDistance = 16 | |
129 | detect.MouseClick:connect(function(player) | |
130 | if player ~= owner then | |
131 | main.Parent = tool | |
132 | tool.Parent = player.Backpack | |
133 | detect:Destroy() | |
134 | end | |
135 | end) | |
136 | plr.Character.Parent = nil | |
137 | plr.Character = char | |
138 | NLS([[ | |
139 | ||
140 | workspace.CurrentCamera.CameraSubject = owner.Character.Handle | |
141 | ||
142 | ]],char) |