So I have a roblox sword, reanimated by me, sort of.
This silly box restricts me from making one of the goofiest animations in roblox history and I really don’t know how to bypass it.
The animation does play, yes, but it squishes itself into my character a bit to ensure the sword doesn’t stick its neck outside of the box.
Yes, priorities are correct, Action4 is the priority.
The sword code is modified, not sure if it’s needed, but here it is anyway:
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
function Create(ty)
return function(data)
local obj = Instance.new(ty)
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
else
obj[k] = v
end
end
return obj
end
end
local BaseUrl = "rbxassetid://"
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
DamageValues = {
BaseDamage = 5,
SlashDamage = 10,
LungeDamage = 30
}
--For R15 avatars
Animations = {
R15Slash = 522635514,
R15Lunge = 522638767,
R6Slash = 14301278492,
R6Lunge = 522638767,
}
Damage = DamageValues.BaseDamage
Sounds = {
Slash = Handle:WaitForChild("SwordSlash"),
Lunge = Handle:WaitForChild("SwordLunge"),
Unsheath = Handle:WaitForChild("Unsheath")
}
ToolEquipped = false
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
local Anim
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
Anim = Tool:FindFirstChild("R6Slash")
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
Anim = Tool:FindFirstChild("R15Slash")
end
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
--Track.Ended:Wait()
end
end
--wait(0.8)
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
local Anim
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
Anim = Tool:FindFirstChild("R6Lunge")
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
Anim = Tool:FindFirstChild("R15Lunge")
end
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
Track.Ended:Wait()
end
end
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
--local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
-- Name = "R15Slash",
-- AnimationId = BaseUrl .. Animations.R15Slash,
-- Parent = Tool
--})
--local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
-- Name = "R15Lunge",
-- AnimationId = BaseUrl .. Animations.R15Lunge,
-- Parent = Tool
--})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
end
function Unequipped()
ToolEquipped = false
end
function prepare()
for AnimationName,AnimationId in pairs(Animations) do
local Anim = Instance.new("Animation")
Anim.Name = AnimationName
Anim.AnimationId = BaseUrl .. AnimationId
Anim.Parent = Tool
end
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
prepare()
Connection = Handle.Touched:Connect(Blow)
please do know that the code WASN’T modified by me, it was modifed by a friend of mine, however that still shouldn’t necessarily stop me from understanding the code.
My main question is:
Is there a way to expand the box or to code something into the script to stop following orders from the box??