Im working in an animation where the character gets the sword from his back and swings it and then keeps holding it.The Swing itself is one step of the animation.
This is the result i expected: https://www.youtube.com/watch?v=RdC79thnF5A
But instead i got this result: https://youtu.be/qZeCgRbZJVA
There are only 2 Scripts Affecting the sword Motor6D wich are:
The Sword Giver:
local Players = game:GetService("Players")
function createWeld(a, b)
local weld = Instance.new("Motor6D")
weld.Name = "Weld"
weld.Part0 = a
weld.Part1 = b
weld.C0 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld
end
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local GrandSword = game:GetService("ReplicatedStorage").GrandSword:Clone()
local Torso = Character:WaitForChild("Torso")
GrandSword.Parent = Character
local Weld = createWeld(GrandSword.Handle, Torso)
Weld.C0 = CFrame.new(-3.7, 0, -.7) * CFrame.Angles(0, math.rad(0), -44.4)
end)
end)
And:
The Sword Equipper (Plays the equipping animation):
local Character = game:GetService("Players").LocalPlayer.Character
local Humanoid = Character.Humanoid
local WalkSpeed = Humanoid.WalkSpeed
local UIS = game:GetService("UserInputService")
local Handle = Character:WaitForChild("GrandSword").Handle
local Toggled = false
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://4535917504/"
Anim.Parent = Handle
UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
local keyPressed = input.KeyCode
if keyPressed == Enum.KeyCode.F then
if Toggled == false then
Toggled = true
Humanoid.WalkSpeed = 0
local AnimTrack = Character.Humanoid:LoadAnimation(Anim)
AnimTrack:Play()
wait(0.3)
Handle.Weld.Part1 = Character["Right Arm"]
print("Equipped")
else
Handle.Weld.Part1 = Character.Torso
Humanoid.WalkSpeed = WalkSpeed
Toggled = false
end
end
end
end)
Any idea of why this is happening and how can i fix the issue?
I know this might be a big request but any help would be appreciated!Thanks!
