I basically have a knife part (not a Tool) welded onto a Player’s hand. And in their StarterPlayerScript, I have a script like this:
character.ChildAdded:Connect(function(thing)
if thing.Name == "Knife_001" then
local animator = character.Humanoid:WaitForChild("Animator");
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://2515090838"
local track = animator:LoadAnimation(Anim);
UserInputService.InputBegan:Connect(function(InputObject)
if InputObject.UserInputType == Enum.UserInputType.MouseButton1 then
print("TEST");
track:Play()
end
end)
end
end)
The animation ID isn’t a knife slash, but I wanted to put something in there to see if it would work, but it didn’t animate the player. It prints “TEST” so I know that the connection works.
How do I make it so that “Knife_001” does damage when it hits a player and force an animation when the player presses left click?