I have this simple model for trying out ikcontrol, this script works on an r6 rig but wont work on my custom rig, does anybody know how to fix this? There are no errors and the script works perfectly fine, but the rig itself will not move its limbs.
local character = script.Parent
local ik = Instance.new("IKControl")
ik.Parent = character:FindFirstChild("Humanoid")
ik.Type = Enum.IKControlType.Position
ik.ChainRoot = character:FindFirstChild("Left Arm")
ik.EndEffector = character:FindFirstChild("Left Arm2", true)
-----------------------------------------
wait(2)
local humpart = character:FindFirstChild("HumanoidRootPart")
local raycasted = false
while true do
if raycasted == false then
raycasted = true
local part1 = humpart.Position
local part2 = humpart.Position - Vector3.new(20,20,-20)
local direction = part2 - part1
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {script.Parent:GetDescendants()}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local raycastresult = workspace:Raycast(humpart.Position, direction, raycastParams)
print("fired")
if raycastresult then
local magnitude = (humpart.Position - raycastresult.Position).magnitude
print(magnitude)
print("raycastres")
local newpart = Instance.new("Part")
newpart.CanCollide = false
newpart.Anchored = true
newpart.Transparency = .5
newpart.Material = Enum.Material.ForceField
newpart.CFrame = CFrame.new(raycastresult.Position)
newpart.Parent = workspace
ik.Target = newpart
if magnitude < 6 then
repeat wait(.5)
local magnitude2 = (humpart.Position - raycastresult.Position).magnitude
until magnitude2 > 6
print("larger than six")
newpart:Destroy()
raycasted = false
elseif magnitude > 6 then
print("Already larger than six")
newpart:Destroy()
raycasted = false
end
end
end
wait(.2)
end