Hello I am currently having trouble finding a way to change my script so that it will play an animation that I made instead of the roblox slash.
Script:
local tool = script.Parent
local canDamage = false
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if not humanoid then
return
end
if humanoid.Parent ~= tool.Parent and canDamage then
tagHumanoid(humanoid);
humanoid:TakeDamage(50)
else
return
end
canDamage = false
end
local function slash()
local str = Instance.new("StringValue")
str.Name = "toolanim"
str.Value = "Slash"
str.Parent = tool
canDamage = true
end
function tagHumanoid(hum)
local existingTag = hum:FindFirstChild("creator");
if existingTag then
existingTag:Destroy();
end
local tag = Instance.new("ObjectValue");
tag.Name = "creator";
tag.Value = game.Players:GetPlayerFromCharacter(tool.Parent);
tag.Parent = hum;
end
tool.Activated:Connect(slash)
tool.Handle.Touched:Connect(onTouch)