idk why this literally worked and now it doesnt. Keep in mind some tables are positioned under for loops for the parenting and other stuff -
the finger parts get added, so does the motors
the motorindex doesnt work
the ikcontrols get added
the ikindex doesnt work
i think its the if statements but idk im so lost now
the for loop for each table with the word “index” wont work
local module = {}
function module:module(player, character)
-- //Humanoid
local Humanoid = character:FindFirstChild("Humanoid")
-- //
local parts = {
["RightFinger"] = script.Parent:FindFirstChild("parts"):FindFirstChild("RightFinger"),
["LeftFinger"] = script.Parent:FindFirstChild("parts"):FindFirstChild("LeftFinger")
}
for _, part in pairs(parts) do
self.clone = part:Clone()
if not character:FindFirstChild(self.clone.Name) then
self.clone.Parent = character
end
end
local motors = {
["Right Point"] = Instance.new("Motor6D", character:FindFirstChild("RightFinger")),
["Left Point"] = Instance.new("Motor6D", character:FindFirstChild("LeftFinger"))
}
local motorindex = {
["Right Point"] = {Part1 = character:FindFirstChild("RightHand"), C0 = CFrame.new(0, 0.4, 0) * CFrame.Angles(0, math.rad(180), 0)},
["Left Point"] = {Part1 = character:FindFirstChild("LeftHand"), C0 = CFrame.new(0, 0.4, 0) * CFrame.Angles(0, math.rad(90), 0)}
}
for _, joint in pairs(motors) do
joint.Name = _
joint.Part0 = joint.Parent
for a, index in pairs(motorindex) do
for b, property in pairs(index) do
if a == joint.Name then
joint[b] = property
print()
end
end
end
end
-- //
local ikcontrols = {
["IKHead"] = Instance.new("IKControl", Humanoid),
["IKRight"] = Instance.new("IKControl", Humanoid),
["IKLeft"] = Instance.new("IKControl", Humanoid),
}
local ikindex = {
["IKHead"] = {ChainRoot = character:FindFirstChild("UpperTorso"), EndEffector = character:FindFirstChild("Head"), Target = nil},
["IKRight"] = {ChainRoot = character:FindFirstChild("RightUpperArm"), EndEffector = character:FindFirstChild("RightHand"), Target = nil, Type = Enum.IKControlType.LookAt},
["IKLeft"] = {ChainRoot = character:FindFirstChild("LeftUpperArm"), EndEffector = character:FindFirstChild("LeftHand"), Target = nil, Type = Enum.IKControlType.LookAt}
}
for _, ik in pairs(ikcontrols) do
ik.Name = _
for a, index in pairs(ikindex) do
for b, data in pairs(index) do
if a == ik.Name then
ik[b] = data
print()
end
end
end
end
end
return module