View difference between Paste ID: vWW2dCiS and gQms2Q6e
SHOW: | | - or go back to the newest paste.
1
-- Objects
2
3
local Sword = Instance.new("Model")
4
local Player = game.Players.LocalPlayer
5
local Char = Player.Character
6
local BaseAttachment = Instance.new("Attachment")
7
local BladeAttackment = Instance.new("Attachment")
8
local Blade = Instance.new("Part")
9
local Mouse = Player:GetMouse()
10
local Trail = Instance.new("Trail")
11
local RunService = game:GetService("RunService")
12
local Handle = Instance.new("Part")
13
local HandleToBlade = Instance.new("Weld")
14
local HandToTorso = Instance.new("Weld")
15
local HandleToHand = Instance.new("Weld")
16
local BladeToSharp = Instance.new("Weld")
17
local Sharp = Instance.new("WedgePart")
18
local Slash = false
19
local Blood = Instance.new("Part")
20
local BloodCont = Instance.new("Model")
21
local Smoothner = Instance.new("BlockMesh")
22
local Attacking = false
23
local HitSound = Instance.new("Sound")
24
local SlashSound = Instance.new("Sound")
25
local CFrames = 
26
{
27
	t_HandToTorso = 
28
	{
29
		BackClick = CFrame.new(-1.5, 1, 0) * CFrame.Angles(3.5, 0, 0),
30
		BackStab =  CFrame.new(-1.5, 0.5, -0.5) * CFrame.Angles(1.5, 0, 0),
31
		FrontClick = CFrame.new(-1.5, 0, 0) * CFrame.Angles(0, 0, 0),
32
		FrontStab = CFrame.new(-1.5, 0.5, 0.5) * CFrame.Angles(-1.5, 0, 0)
33
	},
34
	t_HandleToHand = 
35
	{
36
		BackClick = CFrame.new(0, 0, 0) * CFrame.Angles(-5, 0.2, 1),
37
		BackStab = CFrame.new(0, 0, 0) * CFrame.Angles(0.3, 0, 0),
38
		FrontClick = CFrame.new(0, 0, 0) * CFrame.Angles(1.5, 0, 0),
39
		FrontStab = CFrame.new(0, 0, 0) * CFrame.Angles(3, 0, 0)
40
	}
41
}
42
43
-- Assets
44
45
game.ContentProvider:Preload("rbxassetid://196969716") -- Trail Texutre
46
game.ContentProvider:Preload("rbxassetid://158037267") -- Slash Sound
47
game.ContentProvider:Preload("rbxassetid://186311262") -- Hit Sound
48
49
-- Properties
50
51
Sword.Parent = Char
52
Sword.Name = "Sword"
53
54
Handle.BrickColor = BrickColor.new("Dark orange")
55
Handle.Material = "Marble"
56
Handle.Name = "Handle"
57
Handle.Anchored = false
58
Handle.CanCollide = false
59
Handle.Size = Vector3.new(0.1, 1, 0.35)
60
Handle.BackSurface = "SmoothNoOutlines"
61
Handle.BottomSurface = "SmoothNoOutlines"
62
Handle.FrontSurface = "SmoothNoOutlines"
63
Handle.LeftSurface = "SmoothNoOutlines"
64
Handle.RightSurface = "SmoothNoOutlines"
65
Handle.TopSurface = "SmoothNoOutlines"
66
67
68-
Blade.BrickColor = BrickColor.new("Fossil")
68+
Blade.BrickColor = BrickColor.new("Toothpaste")
69
Blade.Material = "Neon"
70
Blade.Name = "Blade"
71
Blade.Anchored = false
72
Blade.CanCollide = false
73
Blade.Size = Vector3.new(0.1, 4.84, 0.35)
74
Blade.BackSurface = "SmoothNoOutlines"
75
Blade.BottomSurface = "SmoothNoOutlines"
76
Blade.FrontSurface = "SmoothNoOutlines"
77
Blade.LeftSurface = "SmoothNoOutlines"
78
Blade.RightSurface = "SmoothNoOutlines"
79
Blade.TopSurface = "SmoothNoOutlines"
80
81-
Sharp.BrickColor = BrickColor.new("Fossil")
81+
Sharp.BrickColor = BrickColor.new("Toothpaste")
82
Sharp.Material = "Neon"
83
Sharp.Name = "Sharp"
84
Sharp.Anchored = false
85
Sharp.CanCollide = false
86
Sharp.Size = Vector3.new(0.1, 1, 0.35)
87
Sharp.BackSurface = "SmoothNoOutlines"
88
Sharp.BottomSurface = "SmoothNoOutlines"
89
Sharp.FrontSurface = "SmoothNoOutlines"
90
Sharp.LeftSurface = "SmoothNoOutlines"
91
Sharp.RightSurface = "SmoothNoOutlines"
92
Sharp.TopSurface = "SmoothNoOutlines"
93
94
Blood.BrickColor = BrickColor.new("Really red")
95
Blood.Size = Vector3.new(0.5, 0.3, 0.6)
96
97
BloodCont.Name = "BloodCont"
98
99
Smoothner.Parent = Blood
100
101
BaseAttachment.Parent = Sharp
102
BladeAttackment.Parent = Blade
103
104
Trail.Attachment0 = BaseAttachment
105
Trail.Attachment1 = BladeAttackment
106
Trail.Parent = Sharp
107
Trail.Enabled = false
108
Trail.Transparency = NumberSequence.new(0, 1)
109
Trail.Texture = "rbxassetid://196969716"
110
Trail.Lifetime = 0.15
111
112
SlashSound.Parent = Handle
113
SlashSound.Name = "SlashSound"
114
SlashSound.Volume = 0.4
115
SlashSound.SoundId = "rbxassetid://158037267"
116
117
HitSound.Parent = Handle
118
HitSound.Name = "HitSound"
119
HitSound.Volume = 0.4
120
HitSound.PlaybackSpeed = 2.4
121
HitSound.SoundId = "rbxassetid://186311262"
122
123
-- Welds
124
125
HandleToBlade.Part0 = Handle
126
HandleToBlade.C0 = CFrame.new(0, 2.92, 0)
127
HandleToBlade.Part1 = Blade
128
HandleToBlade.Name = "HandleToBlade"
129
HandleToBlade.Parent = Handle
130
131
BladeToSharp.Part0 = Sharp
132
BladeToSharp.C0 = CFrame.new(0, -2.92, 0)
133
BladeToSharp.Part1 = Blade
134
BladeToSharp.Parent = Handle
135
BladeToSharp.Name = "BladeToSharp"
136
137
HandleToHand.Part0 = Handle
138
HandleToHand.Name = "HandleToHand"
139
HandleToHand.C0 = CFrame.Angles(1.5, 0, 0)
140
HandleToHand.C1 = CFrame.new(0, -1, 0)
141
HandleToHand.Part1 = Char["Right Arm"]
142
HandleToHand.Parent = Handle
143
144
HandToTorso.Part0 = Char["Right Arm"]
145
HandToTorso.Part1 = Char.Torso
146
HandToTorso.Name = "HandToTorso"
147
HandToTorso.Parent = Handle
148
HandToTorso.C0 = CFrame.new(-1.5, 0, 0)
149
150
Handle.Parent = Sword
151
Blade.Parent = Sword
152
Sharp.Parent = Sword
153
154
-- Functions
155
156
157
Mouse.Button1Down:Connect(function()
158
	if Slash == false then
159
		CFrames.t_HandleToHand.Back = CFrame.new(0, 0, 0) * CFrame.Angles(-5, math.random(-1, 1.2), 1)
160
		Trail.Enabled = true
161
		Slash = true
162
		
163
		for Back = 0, 1, 0.05 do
164
			HandleToHand.C0 = HandleToHand.C0:lerp(CFrames.t_HandleToHand.BackClick, Back)
165
			HandToTorso.C0 = HandToTorso.C0:lerp(CFrames.t_HandToTorso.BackClick, Back)
166
			RunService.Stepped:wait()
167
		end
168
		
169
		SlashSound:Play()	
170
		
171
		for Front = 0, 1, 0.1 do
172
			HandleToHand.C0 = HandleToHand.C0:lerp(CFrames.t_HandleToHand.FrontClick, Front)
173
			HandToTorso.C0 = HandToTorso.C0:lerp(CFrames.t_HandToTorso.FrontClick, Front)
174
			RunService.Stepped:wait()
175
		end
176
		
177
		Slash = false
178
		Trail.Enabled = false
179
	end
180
end)
181
182
Mouse.KeyDown:Connect(function(key)
183
	if key == "q" and Slash == false then
184
		Slash = true
185
		Trail.Enabled = true
186
		
187
		for Back = 0, 1, 0.025 do
188
			HandleToHand.C0 = HandleToHand.C0:lerp(CFrames.t_HandleToHand.BackStab, Back)
189
			HandToTorso.C0 = HandToTorso.C0:lerp(CFrames.t_HandToTorso.BackStab, Back)
190
			RunService.Stepped:wait()
191
		end
192
		
193
		SlashSound:Play()	
194
		
195
		for Front = 0, 1, 0.1 do
196
			HandleToHand.C0 = HandleToHand.C0:lerp(CFrames.t_HandleToHand.FrontStab, Front)
197
			HandToTorso.C0 = HandToTorso.C0:lerp(CFrames.t_HandToTorso.FrontStab, Front)
198
			RunService.Stepped:wait()
199
		end
200
		
201
		for Def = 0, 1, 0.1 do
202
			HandleToHand.C0 = HandleToHand.C0:lerp(CFrames.t_HandleToHand.FrontClick, Def)
203
			HandToTorso.C0 = HandToTorso.C0:lerp(CFrames.t_HandToTorso.FrontClick, Def)
204
			RunService.Stepped:wait()
205
		end
206
		
207
		Slash = false
208
		Trail.Enabled = false
209
	end
210
end)
211
212
Blade.Touched:Connect(function(hit)
213
	if Slash == true and hit.Parent:FindFirstChild("Humanoid") and hit.Parent ~= game.Players.LocalPlayer.Character and Attacking == false then
214
		hit.Parent.Humanoid:TakeDamage(math.random(10, 20))
215
		Handle.HitSound.Playing = true
216
		Attacking = true
217
		BloodCont.Parent = hit.Parent.Torso
218
		for i = 1, math.random(4, 7) do
219
			local CBlood = Blood:Clone()
220
			CBlood.Parent = BloodCont
221
			CBlood.CFrame = hit.Parent.Torso.CFrame
222
		end
223
		wait(0.5)
224
		BloodCont:Remove()
225
		Attacking = false
226
	end
227
end)