if script == nil then return end
Player = [Link]
Char = [Link]
animate = Char:findFirstChild("Animate")
if animate then
animate:remove()
end
Name = "Chainsaw"
selected = false
Button1Down = false
damage = 10
canUse = true
activated = false
swordType = "normal"
animation = {}
animation["slashing"] = nil
function makeParts(format)
local model = [Link]("Model")
[Link] = Name
[Link] = [Link]
local pm2 = [Link]("Part")
[Link] = "Weld Point"
[Link] = "Custom"
[Link] = [Link](1, 1, 1)
[Link] = [Link]("Really black")
[Link] = 1
[Link] = true
[Link] = 0
[Link] = 0
[Link] = model
if format ~= nil then
local w = [Link]("Weld")
w.Part0 = pm2
if format == "hand" then
w.Part1 = [Link]:FindFirstChild("Right Arm")
w.C0 = [Link](0, 1.1, 0.3)
w.C1 = [Link]()
[Link] = pm2
elseif format == "holster" then
w.Part1 = [Link]:FindFirstChild("Torso")
w.C0 = [Link](-0.9, -0.5, -0.8) *
[Link]([Link](90), [Link](90), 0)
w.C1 = [Link]()
[Link] = pm2
[Link] = Name.. " (Holstered)"
else
print("Error: Incorrect format string!")
end
end
local pm = [Link]("Part")
[Link] = "Handle"
[Link] = "Custom"
[Link] = [Link](1, 1, 1)
[Link] = [Link]("Bright orange")
[Link] = 0.025
[Link] = true
[Link] = 0
[Link] = 0
[Link] = model
local m = [Link]("SpecialMesh")
[Link] = "Brick"
[Link] = [Link](0.6, 0.9, 1)
[Link] = pm
local w = [Link]("Weld")
w.Part0 = pm
w.Part1 = pm2
w.C0 = [Link]()
w.C1 = [Link]()
[Link] = pm
local s = [Link]("Sound")
[Link] = "Start"
[Link] = "[Link]
[Link] = 1
[Link] = 2
[Link] = false
[Link] = pm
local s = [Link]("Sound")
[Link] = "Saw"
[Link] = "[Link]
[Link] = 1
[Link] = 0.25
[Link] = true
[Link] = pm
local p = [Link]("Part")
[Link] = "Back"
[Link] = "Custom"
[Link] = [Link](1, 1, 1)
[Link] = [Link]("Bright orange")
[Link] = 0.025
[Link] = true
[Link] = 0
[Link] = 0
[Link] = model
local m = [Link]("SpecialMesh")
[Link] = "Wedge"
[Link] = [Link](0.6, 0.8, 0.9)
[Link] = p
local w = [Link]("Weld")
w.Part0 = p
w.Part1 = pm
w.C0 = [Link](0, -0.9, 0) * [Link]([Link](270), 0, 0)
w.C1 = [Link]()
[Link] = p
local p = [Link]("Part")
[Link] = "Blade"
[Link] = "Custom"
[Link] = [Link](1, 1, 3)
[Link] = false
[Link] = [Link]("Institutional white")
[Link] = 0.2
[Link] = true
[Link] = 0
[Link] = 0
[Link] = model
local m = [Link]("SpecialMesh")
[Link] = "Brick"
[Link] = [Link](0.03, 0.7, 0.9)
[Link] = p
local w = [Link]("Weld")
w.Part0 = p
w.Part1 = pm
w.C0 = [Link](0, 0.075, 1.85)
w.C1 = [Link]()
[Link] = p
[Link]:connect(function(hit) onTouched(hit, p, "sword") end)
local p = [Link]("Part")
[Link] = "Blade Tip"
[Link] = "Custom"
[Link] = [Link](1, 1, 1)
[Link] = false
[Link] = [Link]("Institutional white")
[Link] = 0.2
[Link] = true
[Link] = 0
[Link] = 0
[Link] = model
local m = [Link]("CylinderMesh")
[Link] = [Link](0.7, 0.03, 0.7)
[Link] = p
local w = [Link]("Weld")
w.Part0 = p
w.Part1 = pm
w.C0 = [Link](-0.075, 0, 3.2) * [Link](0, 0,
[Link](90))
w.C1 = [Link]()
[Link] = p
[Link]:connect(function(hit) onTouched(hit, p, "sword") end)
end
function removeParts(format)
if format == "hand" then
if [Link]:FindFirstChild(Name) ~= nil then
[Link][Name]:Remove()
end
elseif format == "holster" then
if [Link]:FindFirstChild(Name.. " (Holstered)") ~= nil then
[Link][Name.. " (Holstered)"]:Remove()
end
end
end
function onTouched(hit, source, format)
if format == "sword" then
if [Link]:FindFirstChild("Humanoid") ~= nil and [Link] ~=
[Link] then
tagHumanoid([Link])
if swordType == "normal" then
[Link]:TakeDamage(1)
elseif swordType == "slash" then
[Link]:TakeDamage(damage)
end
delay(3, function() untagHumanoid([Link]) end)
end
end
end
function SetAngle(Joint, Angle, Character)
if Character == nil then return false end
local Joints = {
[Link]:FindFirstChild("Right Shoulder 2"),
[Link]:FindFirstChild("Left Shoulder 2"),
[Link]:FindFirstChild("Right Hip 2"),
[Link]:FindFirstChild("Left Hip 2")
}
if Joints[Joint] == nil then return false end
if Joint == 1 or Joint == 3 then
Joints[Joint].DesiredAngle = Angle
end
if Joint == 2 or Joint == 4 then
Joints[Joint].DesiredAngle = -Angle
end
end
function ForceAngle(Joint, Angle, Character)
if Character == nil then return false end
local Joints = {
[Link]:FindFirstChild("Right Shoulder 2"),
[Link]:FindFirstChild("Left Shoulder 2"),
[Link]:FindFirstChild("Right Hip 2"),
[Link]:FindFirstChild("Left Hip 2")
}
if Joints[Joint] == nil then return false end
if Joint == 1 or Joint == 3 then
Joints[Joint].DesiredAngle = Angle
Joints[Joint].CurrentAngle = Angle
end
if Joint == 2 or Joint == 4 then
Joints[Joint].DesiredAngle = -Angle
Joints[Joint].CurrentAngle = -Angle
end
end
function SetSpeed(Joint, Speed, Character)
if Character == nil then return false end
local Joints = {
[Link]:FindFirstChild("Right Shoulder 2"),
[Link]:FindFirstChild("Left Shoulder 2"),
[Link]:FindFirstChild("Right Hip 2"),
[Link]:FindFirstChild("Left Hip 2")
}
if Joints[Joint] == nil then return false end
Joints[Joint].MaxVelocity = Speed
end
function DisableLimb(Limb, Character)
if Character == nil then return false end
if Character:FindFirstChild("Torso") == nil then return false end
local Joints = {
[Link]:FindFirstChild("Right Shoulder"),
[Link]:FindFirstChild("Left Shoulder"),
[Link]:FindFirstChild("Right Hip"),
[Link]:FindFirstChild("Left Hip")
}
local Limbs = {
Character:FindFirstChild("Right Arm"),
Character:FindFirstChild("Left Arm"),
Character:FindFirstChild("Right Leg"),
Character:FindFirstChild("Left Leg")
}
if Joints[Limb] == nil then return false end
if Limbs[Limb] == nil then return false end
local Joint = [Link]("Motor")
[Link] = [Link]
Joint.Part0 = [Link]
Joint.Part1 = Limbs[Limb]
if Limb == 1 then
Joint.C0 = [Link](1.5, 0.5, 0) * [Link](0,
[Link](90), 0)
Joint.C1 = [Link](0, 0.5, 0) * [Link](0,
[Link](90), 0)
[Link] = "Right Shoulder 2"
elseif Limb == 2 then
Joint.C0 = [Link](-1.5, 0.5, 0) * [Link](0,
[Link](-90), 0)
Joint.C1 = [Link](0, 0.5, 0) * [Link](0, [Link](-
90), 0)
[Link] = "Left Shoulder 2"
elseif Limb == 3 then
Joint.C0 = [Link](0.5, -1, 0) * [Link](0,
[Link](90), 0)
Joint.C1 = [Link](0, 1, 0) * [Link](0, [Link](90),
0)
[Link] = "Right Hip 2"
elseif Limb == 4 then
Joint.C0 = [Link](-0.5, -1, 0) * [Link](0,
[Link](-90), 0)
Joint.C1 = [Link](0, 1, 0) * [Link](0, [Link](-
90), 0)
[Link] = "Left Hip 2"
end
[Link] = Joints[Limb].MaxVelocity
[Link] = Joints[Limb].CurrentAngle
[Link] = Joints[Limb].DesiredAngle
Joints[Limb]:Remove()
end
function ResetLimbCFrame(Limb, Character)
if Character == nil then return false end
if [Link] == nil then return false end
if Character:FindFirstChild("Torso") == nil then return false end
local Joints = {
[Link]:FindFirstChild("Right Shoulder 2"),
[Link]:FindFirstChild("Left Shoulder 2"),
[Link]:FindFirstChild("Right Hip 2"),
[Link]:FindFirstChild("Left Hip 2")
}
local Limbs = {
Character:FindFirstChild("Right Arm"),
Character:FindFirstChild("Left Arm"),
Character:FindFirstChild("Right Leg"),
Character:FindFirstChild("Left Leg")
}
if Joints[Limb] == nil then return false end
if Limbs[Limb] == nil then return false end
if Limb == 1 then
Joints[Limb].C0 = [Link](1.5, 0.5, 0) * [Link](0,
[Link](90), 0)
Joints[Limb].C1 = [Link](0, 0.5, 0) * [Link](0,
[Link](90), 0)
elseif Limb == 2 then
Joints[Limb].C0 = [Link](-1.5, 0.5, 0) * [Link](0,
[Link](-90), 0)
Joints[Limb].C1 = [Link](0, 0.5, 0) * [Link](0,
[Link](-90), 0)
elseif Limb == 3 then
Joints[Limb].C0 = [Link](0.5, -1, 0) * [Link](0,
[Link](90), 0)
Joints[Limb].C1 = [Link](0, 1, 0) * [Link](0,
[Link](90), 0)
elseif Limb == 4 then
Joints[Limb].C0 = [Link](-0.5, -1, 0) * [Link](0,
[Link](-90), 0)
Joints[Limb].C1 = [Link](0, 1, 0) * [Link](0,
[Link](-90), 0)
end
end
function EnableLimb(Limb, Character)
if Character == nil then return false end
if Character:FindFirstChild("Torso") == nil then return false end
local Joints = {
[Link]:FindFirstChild("Right Shoulder 2"),
[Link]:FindFirstChild("Left Shoulder 2"),
[Link]:FindFirstChild("Right Hip 2"),
[Link]:FindFirstChild("Left Hip 2")
}
local Limbs = {
Character:FindFirstChild("Right Arm"),
Character:FindFirstChild("Left Arm"),
Character:FindFirstChild("Right Leg"),
Character:FindFirstChild("Left Leg")
}
if Joints[Limb] == nil then return false end
if Limbs[Limb] == nil then return false end
if Limb == 1 then
Joints[Limb].Name = "Right Shoulder"
elseif Limb == 2 then
Joints[Limb].Name = "Left Shoulder"
elseif Limb == 3 then
Joints[Limb].Name = "Right Hip"
elseif Limb == 4 then
Joints[Limb].Name = "Left Hip"
end
Animate = Character:FindFirstChild("Animate")
if Animate == nil then return false end
Animate = Animate:Clone()
[Link]:Remove()
[Link] = Character
end
function playAnimation(format, mouse)
if format == "normal" then
SetSpeed(1, 0.2, [Link])
SetAngle(1, [Link](90), [Link])
end
if format == "slashStart" then
SetSpeed(1, 0.5, [Link])
SetAngle(1, [Link](10), [Link])
wait(0.05)
animation["slashing"] = true
while animation["slashing"] == true do
SetSpeed(1, 0.075, [Link])
SetAngle(1, [Link]([Link](10, 45)), [Link])
[Link][Name].[Link].C0 = [Link](0, 0, 0) *
[Link]([Link]([Link](-30, 30)), 0, 0)
wait([Link](5, 10) / 100)
end
end
if format == "slashEnd" then
animation["slashing"] = false
SetSpeed(1, 0.5, [Link])
SetAngle(1, [Link](90), [Link])
[Link][Name].[Link].C0 = [Link]()
end
end
function Weld(x, y)
local weld = [Link]("Weld")
weld.Part0 = x
weld.Part1 = y
CJ = [Link]([Link])
C0 = [Link]:inverse() * CJ
C1 = [Link]:inverse() * CJ
weld.C0 = C0
weld.C1 = C1
[Link] = x
end
function tagHumanoid(humanoid)
local tag = [Link]("ObjectValue")
[Link] = "creator"
[Link] = Player
[Link] = humanoid
local tag = [Link]("StringValue")
[Link] = "creatorType1"
[Link] = Name
[Link] = humanoid
local tag = [Link]("StringValue")
[Link] = "creatorType2"
[Link] = "cut into pieces"
[Link] = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:FindFirstChild("creator")
if tag ~= nil then
tag:Remove()
end
local tag = humanoid:FindFirstChild("creatorType1")
if tag ~= nil then
tag:Remove()
end
local tag = humanoid:FindFirstChild("creatorType2")
if tag ~= nil then
tag:Remove()
end
end
end
function onButton1Down(mouse)
if selected == false then return end
if [Link]:FindFirstChild(Name) ~= nil and Button1Down == false and
canUse == true and activated == true then
if [Link][Name]:FindFirstChild("Handle") == nil then return end
[Link] = "rbxasset://textures\\[Link]"
Button1Down = true
canUse = false
[Link]([Link](function() playAnimation("slashStart")
end))
for i = 0.25, 1, 0.1 do
[Link][Name].[Link] = i
wait()
end
swordType = "slash"
canUse = true
end
end
function onButton1Up(mouse)
if selected == false or Button1Down == false then return end
Button1Down = false
while canUse == false do wait() end
canUse = false
[Link]([Link](function() playAnimation("slashEnd") end))
for i = 1, 0.25, -0.05 do
[Link][Name].[Link] = i
wait()
end
[Link][Name].[Link] = 0.25
swordType = "normal"
[Link] = "rbxasset://textures\\[Link]"
canUse = true
end
function onKeyDown(key, mouse)
if selected == false then return end
key = key:lower()
if key == "q" and Button1Down == false and canUse == true then
if [Link] == nil then return end
if game:GetService("Players"):GetPlayerFromCharacter([Link])
~= nil then
onDeselected(mouse)
removeParts("holster")
[Link] =
game:GetService("Players"):GetPlayerFromCharacter([Link]).Backpack
end
end
if key == "e" and Button1Down == false and canUse == true then
if activated == true then
canUse = false
for i = 1, 0, -0.05 do
[Link][Name].[Link] = i
[Link][Name].[Link] =
[Link][Name].[Link] / 1.05
wait()
end
[Link][Name].[Link]:Stop()
[Link][Name].[Link] = 1
[Link][Name].[Link] = 1
[Link][Name].[Link]:Play()
activated = false
wait(0.3)
canUse = true
elseif activated == false then
canUse = false
[Link][Name].[Link] = 1
[Link][Name].[Link] = 1
[Link][Name].[Link]:Play()
wait(0.2)
activated = true
[Link][Name].[Link]:Play()
for i = 0, 1, 0.05 do
[Link][Name].[Link] = i
[Link][Name].[Link] = i / 4
wait()
end
[Link][Name].[Link] = 1
[Link][Name].[Link] = 0.25
canUse = true
end
end
if key == "r" and Button1Down == false and canUse == true and activated == true
then
canUse = false
[Link][Name].[Link] = [Link](9, 15) / 10
[Link][Name].[Link] = 1
[Link][Name].[Link]:Play()
for i = 0, 1.5, 0.1 do
[Link][Name].[Link] = ([Link](i) / 1.25) + 0.25
wait()
end
for i = 1.5, 3.1, 0.05 do
[Link][Name].[Link] = ([Link](i) / 1.25) + 0.25
wait()
end
[Link][Name].[Link] = 0.25
canUse = true
end
if key == "t" and Button1Down == false and canUse == true and activated == true
then
canUse = false
[Link][Name].[Link] = [Link](9, 15) / 10
[Link][Name].[Link] = 1
[Link][Name].[Link]:Play()
wait(0.2)
canUse = true
end
end
function onSelected(mouse)
if selected == true then return end
selected = true
[Link] = "rbxasset://textures\\[Link]"
while [Link]:FindFirstChild("WeaponActivated") ~= nil do
if [Link] == nil then break end
if [Link] == nil then break end
wait()
end
[Link] = "rbxasset://textures\\[Link]"
local weapon = [Link]("ObjectValue")
[Link] = "WeaponActivated"
[Link] = [Link]
[Link] = [Link]
DisableLimb(1, [Link])
removeParts("holster")
makeParts("hand")
playAnimation("normal")
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
[Link]:connect(function(key) onKeyDown(key, mouse) end)
if connection ~= nil then connection:disconnect() end
connection = [Link]:connect(function() canUse = true
onDeselected(mouse) end)
end
function onDeselected(mouse)
if selected == false then return end
if Button1Down == true then
[Link]([Link](function() playAnimation("slashEnd")
end))
for i = 1, 0.25, -0.05 do
[Link][Name].[Link] = i
wait()
end
[Link][Name].[Link] = 0.25
Button1Down = false
end
if activated == true then onKeyDown("e", mouse) end
selected = false
while canUse == false do
wait()
end
if [Link]:FindFirstChild("WeaponActivated") ~= nil then
if [Link] == [Link] then
[Link]:Remove()
end
end
while [Link]:FindFirstChild("WeaponActivated") ~= nil do
if [Link] == nil then break end
if pcall(function() if [Link] == nil
then return true end end) then break end
wait()
end
swordType = "normal"
EnableLimb(1, [Link])
removeParts("hand")
makeParts("holster")
end
if [Link] ~= "HopperBin" then
if Player == nil then print("Error: Player not found!") return end
Tool = [Link]("HopperBin")
[Link] = Name
[Link] = [Link]
[Link] = "Main"
[Link] = Tool
Player = [Link]
makeParts("holster")
[Link]:connect(onSelected)
[Link]:connect(onDeselected)
end wait()