Hello, my name is rip_Zephyr, I’m currently making a sword swinging template for a future game. Sadly, I don’t know how to animate the sword. I’ve tried multiple things but they never worked. Here is my code:
local sword = script.Parent
local function swordEquipped()
canBeUsed = true
end
local function swordActivated()
if canBeUsed == true then
-- I want the code that plays the animation to go here
-- The Animation ID is "rbxassetid://18179893944"
end
end
sword.Equipped:Connect(swordEquipped)
sword.Activated:Connect(swordActivated)
If anyone knows how to do this please reply down below this is a competition with my friend on who can make the best game and I seriously want to win because I have better grades than him.
Oh yeah I know I sound kinda stupid for this but if you have time do you mind posting an example of this code i know what you mean but i dont know how to apply it
local sword = script.Parent -- Assuming the sword is a child of the tool
local tool = sword.Parent
local handle = sword:WaitForChild("Handle") -- Assuming the sword's handle is named "Handle"
local weld = Instance.new("Weld")
weld.Parent = handle
weld.Part0 = handle
weld.Part1 = tool:WaitForChild("Handle") -- Assuming the tool's handle is named "Handle"
weld.C0 = CFrame.new(0, 0, 0) -- Adjust this to position the sword in the player's hand
local swingAnimation = Instance.new("Animation")
swingAnimation.AnimationId = "rbxassetid://INSERT_ANIMATION_ID_HERE" -- Insert the animation ID for the swinging animation
local animator = humanoid:FindFirstChildOfClass("Animator")
local animationTrack = animator:LoadAnimation(swingAnimation)
animationTrack:Play()