Video of ability: Screen Recording 2025-02-09 at 9.35.53 PM.mov - Google Drive
Basically I’m working on an M1 for my game, and basically what it does is, clones a sword mesh and weld constraint into the right arm, and cycles through 2 animations. Usually everything works fine, but in the video you can see when I’m spamming it or jumping, (which is likely going to happen when players use it) the sword sometimes appears weirdly. I’m guessing this is because of the arm rotation in the animation and the CFrame setting the sword’s position.
Script:
local itemsFolder = game.ReplicatedStorage.CHEESELORDM1.ITEMS
game.ReplicatedStorage.CHEESELORDM1.addCustomHold.OnServerEvent:Connect(function(player, char, decayTime)
print("recieved M1")
print("decay time: "..decayTime.." seconds")
local rightArm = char:FindFirstChild("Right Arm")
if rightArm then
print("right arm found. player: "..char.Name)
local item = itemsFolder.chezSword:Clone()
item.Parent = rightArm
local weld = itemsFolder.ChezSwordWeldConstraint:Clone()
weld.Parent = rightArm
local prevWalk = char.Humanoid.WalkSpeed
local prevJump = char.Humanoid.JumpPower
char.Humanoid.WalkSpeed = 0
char.Humanoid.JumpPower = 0
game:GetService("Debris"):AddItem(item, decayTime)
game:GetService("Debris"):AddItem(weld, decayTime)
local cFrame = rightArm.CFrame * CFrame.new(0, -0.8, -1.68) -- Move the mesh to the right arm
item.CFrame = cFrame
weld.Part0 = rightArm
weld.Part1 = item
item.Orientation = char.HumanoidRootPart.Orientation + Vector3.new(-90,0,0)
wait(0.05)
char.Humanoid.WalkSpeed = prevWalk
char.Humanoid.JumpPower = prevJump
else
print("RightArm not found for player: "..char.Name)
end
end)
Please guys, let me know if you need any more information. Any help appreciated!