Hello fellow developers,
Currently, I’m trying to make a combat system in which when you click a sword appears in your hand and the animations play accordingly.
Although I’ve been able to get this to work in some sort of fashion, the issue is that when making the sword appear in the player’s hands the way the script is made as to which it creates a motor for the sword to be placed in their hands.
-- part of the script that makes it appear in the player's hand] function swordmodule.equip(_char, _handle, _port) motor = Instance.new("Motor6D", _char['Right Arm']) motor.Part0 = _char['Right Arm'] motor.Part1 = _handle motor.C1 = CFrame.new(0.0294494666, 0.0971527249, 0.0524852239, -3.83993531e-11, -0.000976632931, 0.999999523, -0.99906826, 0.0431613103, 4.21527402e-05, -0.0431613177, -0.999067664, -0.000975722854) motor.C0 = CFrame.new(0.013999939, -0.863999844, -0.013999939, -4.26901951e-11, -0.000976637821, 0.999999523, -8.74227482e-08, -0.999999464, -0.000976637704, 0.999999523, -8.74227126e-08, -4.26901743e-11) _port.Part1 = nil end
- In accordance with possible solutions, I’ve tried using a debounce in which if there is a motor already in the Right Arm then it would not appear again, although this did not result in the problem being fixed.
-- solutions I've tried if not _character["Right Arm"]:FindFirstChild("Motor") then swordmodule.equip(_character, _weapons.Weapon:WaitForChild("Handle"), _weapons.Sheath.Port:WaitForChild("Main")) end
Altogether I’m just looking for some answers for this; along with some tips and critique on my scripting if anything, I just got into scripting a while ago I’m new to using the Lua engine and I’d like to get better at using this.
Thank you for reading and any help is greatly appreciated.