View difference between Paste ID: Ad6hrtv1 and HjFhX8Jx
SHOW: | | - or go back to the newest paste.
1
-- Made by GearsOfPower
2
-- http://pastebin.com/raw/FhkuCZDD
3
4
local Player = game.Players.LocalPlayer
5
local Mouse = Player:GetMouse()
6
repeat wait() until Player.Character
7
local Character = Player.Character
8
9
local scriptId = "GhostScriptID-9211"
10
script.Name = scriptId
11
script.Parent = Player.PlayerScripts
12
13
local GhostObject
14
local SwordObject
15
16
-- | Functions
17
18
-- General
19
20
local General = {}
21
22
function General.LoopClosure(parent, func)
23
	for _,v in pairs(parent:GetChildren()) do
24
		func(v)
25
	end
26
end
27
28
function General.IsMainBodyPart(part)
29
	if part:IsA("Part") and part.Name ~= "HumanoidRootPart" and part.Name ~= "Head" then
30
		return true
31
	else
32
		return false
33
	end
34
end
35
36
function General.TweenTransparency(model, start, finish)
37
	local value = start
38
39
	if start < finish then
40
		repeat
41
			value = value + 0.1
42
			General.LoopClosure(model, function(v)
43
				if General.IsMainBodyPart(v) then
44
					v.Transparency = value
45
				end
46
			end)
47
			wait()
48
		until value >= finish
49
	else
50
		repeat
51
			value = value - 0.1
52
			General.LoopClosure(model, function(v)
53
				if General.IsMainBodyPart(v) then
54
					v.Transparency = value
55
				end
56
			end)
57
			wait()
58
		until value <= finish
59
	end
60
end
61
62
function General.TweenSize(part, start, finish, increment, waitTime)
63
	local value = start
64
65
	if start < finish then
66
		repeat
67
			value = value + increment
68
			part.Size = part.Size + Vector3.new(increment, increment, increment)
69
			wait(waitTime)
70
		until value >= finish
71
	else
72
		repeat
73
			value = value - increment
74
			part.Size = part.Size - Vector3.new(increment, increment, increment)
75
			wait(waitTime)
76
		until value <= finish
77
	end
78
end
79
80
function General.TweenSizeCo(part, start, finish, increment, waitTime, tweenFunction, finishedFunction)
81
	coroutine.resume(coroutine.create(function()
82
		local value = start
83
	
84
		if start < finish then
85
			repeat
86
				if part == nil then break end
87
				value = value + increment
88
				part.Size = part.Size + Vector3.new(increment, increment, increment)
89
90
				if tweenFunction ~= nil then tweenFunction() end				
91
				
92
				wait(waitTime)
93
			until value >= finish
94
		else
95
			repeat
96
				if part == nil then break end
97
				
98
				value = value - increment
99
				part.Size = part.Size - Vector3.new(increment, increment, increment)
100
				
101
				if tweenFunction ~= nil then tweenFunction() end				
102
				
103
				wait(waitTime)
104
			until value <= finish
105
		end
106
		
107
		if finishedFunction ~= nil then
108
			finishedFunction()
109
		end
110
	end))
111
end
112
113
function General.IsCharacter(part)
114
	if part == nil then return end
115
	if part:FindFirstChild("Humanoid") or part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid") then
116
		return true
117
	else
118
		return false
119
	end
120
end
121
122
function General.GetCharacter(part)
123
	if part == nil then return end
124
	if part.Parent:FindFirstChild("Humanoid") then
125
		return part.Parent
126
	elseif part.Parent.Parent:FindFirstChild("Humanoid") then
127
		return part.Parent.Parent
128
	end
129
end
130
131
function General.GetPlayer(part)
132
	local character = General.GetCharacter(part)
133
	
134
	if character ~= nil then
135
		local player = game.Players:GetPlayerFromCharacter(character)
136
		if player ~= nil then
137
			return player
138
		end
139
	end
140
end
141
142
function General.Weld(part1, part2)
143
	local weld = Instance.new("Weld", part1)
144
	weld.Part0 = part1
145
	weld.Part1 = part2
146
	return weld
147
end
148
149
-- Animations
150
151
-- RIGHT ARM ANGLES | C0 ( +FORWARD/-BACK, +TILT LEFT/-TILT RIGHT, +OUT/-IN ) | C1 INVERSE
152
153
local Animation = {}
154
Animation.rigged = false
155
156
function Animation.RigCharacter(character)
157
158
	local rightArmWeld
159
	
160
	if not character.Torso:FindFirstChild("RightArmWeld") then
161
		rightArmWeld = General.Weld(character.Torso, character["Right Arm"])
162
		rightArmWeld.Name = "RightArmWeld"
163
		rightArmWeld.C1 = rightArmWeld.C1 * CFrame.new(-1.5, 0, 0)
164
	else
165
		rightArmWeld = character.Torso.RightArmWeld
166
	end
167
	
168
	Animation.Root = character.HumanoidRootPart:WaitForChild("RootJoint")
169
	Animation.RootRoot = {Animation.Root.C0, Animation.Root.C1} -- the name......
170
	Animation.RightArm = rightArmWeld
171
	Animation.RightArmRoot = {rightArmWeld.C0, rightArmWeld.C1}	
172
	
173
	Animation.rigged = true
174
end
175
176
function Animation.Reset()
177
	if not Animation.rigged then return end
178
	
179
	Animation.Root.C0 = Animation.RootRoot[1]
180
	Animation.Root.C1 = Animation.RootRoot[2]
181
	Animation.RightArm.C0 = Animation.RightArmRoot[1]
182
	Animation.RightArm.C1 = Animation.RightArmRoot[2]
183
end
184
185
function Animation.Destroy()
186
	Animation.RightArm:Destroy()
187
	Animation.rigged = false
188
end
189
190-
-- | Classes
190+