Skip to content

Instantly share code, notes, and snippets.

@howmanysmall
Created July 18, 2019 18:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save howmanysmall/ad6fe01c6c86d84f6ddec43847925d5f to your computer and use it in GitHub Desktop.
Save howmanysmall/ad6fe01c6c86d84f6ddec43847925d5f to your computer and use it in GitHub Desktop.
--player
player = nil
--save shoulders
RSH, LSH = nil, nil
--welds
RW, LW = Instance.new("Weld"), Instance.new("Weld")
--what anim
anim = "none"
--onselected, save shoulders and get player
script.Parent.Selected:connect(function()
player = script.Parent.Parent.Parent
local ch = script.Parent.Parent.Parent.Character
local Torso repeat Torso = ch:FindFirstChild("Torso") until Torso or not wait()
RSH = Torso:WaitForChild("Right Shoulder")
LSH = Torso:WaitForChild("Left Shoulder")
--
RSH.Parent = nil
LSH.Parent = nil
--
RW.Part0 = Torso
RW.C0 = CFrame.new(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
RW.C1 = CFrame.new(0, 0.5, 0)
RW.Part1 = ch:WaitForChild("Right Arm")
RW.Parent = Torso
_G.R = RW
--
LW.Part0 = Torso
LW.C0 = CFrame.new(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
LW.C1 = CFrame.new(0, 0.5, 0)
LW.Part1 = ch:WaitForChild("Left Arm")
LW.Parent = Torso
_G.L = LW
--
--Bring_Arm_Up animation
for i = 0, 1, 0.05 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(--[[1.3]]1.7*i, 0, 0--[[-0.5*i]])
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(1.7*i, 0, 0--[[0.8*i]])
--LW.C1 = CFrame.new(-0.3*i, 0.5+1.2*i, 0)
end
end)
--griptcf = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-math.pi/2+0.5, 0, 0)
script.Parent.Deselected:connect(function()
--Bring_Arm_Down animation
RW.Parent = nil
LW.Parent = nil
RSH.Parent = player.Character.Torso
LSH.Parent = player.Character.Torso
end)
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function ClawHit(hit)
if hit.Parent ~= nil then
nam = hit.Parent.Name
if game.Players:FindFirstChild(nam) ~= nil then
if game.Players[nam].TeamColor == BrickColor.new("Bright red")
then
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = script.Parent.Parent.Parent.Character
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(0)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
end
function Claw()
for i = 0, 1, 0.2 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(1.3+i, 0, 0--[[-0.5+0.5*i]])
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(1.3+i, 0, 0--[[-0.5+0.5*i]])--[[CFrame.fromEulerAnglesXYZ(1.7-0.25*i, 0, 0.8-0.6*i)]]
end
local ch = script.Parent.Parent.Parent.Character
local con1 = ch:FindFirstChild("Right Arm").Touched:connect(ClawHit)
local con2 = ch:FindFirstChild("Left Arm").Touched:connect(ClawHit)
for i = 0, 1, 0.25 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, -0.75) * CFrame.Angles(2.3-2.5*i, 0, -0.3)
LW.C0 = CFrame.new(-1.5, 0.5, -0.75) * CFrame.Angles(2.3-2.5*i--[[1.45-0.25*i]], 0, 0.3--[[0.2]])
end
con1:disconnect()
con2:disconnect()
------
for i = 0, 1, 0.2 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.Angles(1.6*i, 0, 0)--[[CFrame.fromEulerAnglesXYZ(-0.2+1.5*i, 0, -0.5*i)]]
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.Angles(1.6*i, 0, 0)--[[CFrame.fromEulerAnglesXYZ(1.2+0.5*i, 0, 0.2+0.6*i)]]
end
end
local a = false
local co = nil
--OMGHAX mouseclick
local last_click = 0
script.Parent.MouseClick.Changed:connect(function()
if time() - last_click < 0.75 then
else
anim = "norm"
last_click = time()
Claw()
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment