Parts unfindable?

  1. What do you want to achieve?
    ~ I want to find my missing parts.

  2. What is the issue?
    ~ Parts that I absolutely know are in the game, are completely unfindable.

  3. What solutions have you tried so far?
    ~ Spent all day trying to track them down via scripting and google and forum and hub and documentation and run out of ideas.

The Blacksmith rig plays an animation with various events turning different parts transparent and back.
Part way through, the Horse rig moves off via tweeting to waypoints across the map.
As it approaches the goal, the Ous rig comes out to collect swords from the horse and take them away, as the horse runs back to the start.
Once I get this working, the whole thing will be on a continuous loop.

Everything is working really well, minus some little timing issues, nothing drastic.

Except.

All the parts related to the Ous rig animation are apparently non-existent.

Here is the script:

-- Delay to ensure all parts are properly set up
task.wait(10)

-- Services
local TweenService = game:GetService("TweenService")
local Workspace = game:GetService("Workspace")

-- References to rigs and parts
local construction = workspace.ReserveFriends:FindFirstChild("Construction")
local blacksmithModel = construction:FindFirstChild("D_pizza_yt07")
local startPart = construction:FindFirstChild("Start")
local goalPart = construction:FindFirstChild("Goal")
local ousRig = construction:FindFirstChild("D_oussema061")
local swordHorse = construction:FindFirstChild("SwordHorse")

-- Function to create a tween
local function createTween(target, properties, duration)
	local tweenInfo = TweenInfo.new(
		duration, -- Duration in seconds
		Enum.EasingStyle.Linear, -- Easing style
		Enum.EasingDirection.InOut -- Easing direction
	)

	return TweenService:Create(target, tweenInfo, properties)
end

-- ousRig parts
local appleHand = ousRig.RightHand:FindFirstChild("AppleHand")
local appleBasket = ousRig:FindFirstChild("AppleBasket")
local door = workspace.FightArea.Armoury.Building.Doorway.Door:FindFirstChild("Door")
local swordArm1 = ousRig.RightHand:FindFirstChild("SwordArm1")
local swordArm2 = ousRig.RightHand:FindFirstChild("SwordArm2")
local swordArm3 = ousRig.RightHand:FindFirstChild("SwordArm3")
local swordHorse1 = construction.SwordHorse.SwordsOnHorse:FindFirstChild("SwordHorse1")
local swordHorse2 = construction.SwordHorse.SwordsOnHorse:FindFirstChild("SwordHorse2")
local swordhorse3 = construction.SwordHorse.SwordsOnHorse:FindFirstChild("SwordHorse3")


-- Define the waypoint folder
local WPF = Workspace:FindFirstChild("ReserveFriends")
if not WPF then
	warn("ReserveFriends not found.")
	return
end

local constructionFolder = WPF:FindFirstChild("Construction")
if not constructionFolder then
	warn("Construction folder not found.")
	return
end

local waypointsFolder = constructionFolder:FindFirstChild("Waypoints")
if not waypointsFolder then
	warn("Waypoints folder not found.")
	return
end

-- Define the explicit order of waypoints
local waypointNames = {"W1", "W2", "W3", "W4", "W5", "W11", "W6", "W7", "W8", "W9", "W10", "W12", "W13", "W14", "W15", "W16", "W17", "W18", "W19", "W20", "W21", "W22", "W23", "W24", "W25", "W26", "W27", "W28"}

-- Find all waypoints in the folder based on the defined order
local waypoints = {}
for _, name in ipairs(waypointNames) do
	local waypoint = waypointsFolder:FindFirstChild(name)
	if waypoint and waypoint:IsA("BasePart") then
		table.insert(waypoints, waypoint)
	else
		warn("Waypoint " .. name .. " not found or is not a BasePart.")
	end
end

-- Ensure parts and rigs are valid
if not blacksmithModel or not startPart or not goalPart or #waypoints == 0 or not swordHorse then
	warn("Essential parts or rigs are missing.")
	return
end

local Humanoid = blacksmithModel:FindFirstChildOfClass("Humanoid")
local Root = blacksmithModel:FindFirstChild("HumanoidRootPart")

if not Humanoid or not Root then
	warn("Humanoid or HumanoidRootPart is missing.")
	return
end

local startPosition = startPart.Position
local goalPosition = goalPart.Position
local speed = 12 -- Speed at which the rig will move (studs per second)

-- Load and play animation
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://18682298258" -- Updated animation ID
local animTrack = Humanoid:LoadAnimation(animation)
animTrack.Priority = Enum.AnimationPriority.Action
animTrack:AdjustSpeed(.5)

-- Function to set transparency of parts
local function setPartTransparency(part, transparency)
	if part:IsA("BasePart") or part:IsA("MeshPart") or part:IsA("UnionOperation") then
		part.Transparency = transparency
	end
end

-- Function to set transparency of a model's parts
local function setModelTransparency(model, transparency)
	for _, descendant in ipairs(model:GetDescendants()) do
		setPartTransparency(descendant, transparency)
	end
end

-- Visibility functions for the different events
local function setVisibility(model, eventSettings)
	for partName, visibility in pairs(eventSettings) do
		local part = model:FindFirstChild(partName, true) or constructionFolder:FindFirstChild(partName, true)
		if part then
			if part:IsA("Model") then
				setModelTransparency(part, visibility)
			elseif part:IsA("BasePart") or part:IsA("MeshPart") or part:IsA("UnionOperation") then
				part.Transparency = visibility
			else
				warn(partName .. " is not a BasePart, MeshPart, or UnionOperation and its transparency cannot be set.")
			end
		else
			warn("Part " .. partName .. " not found.")
		end
	end
end






-- ousRig Events
local function AppleHand() setVisibility(ousRig, {AppleHand = 0, AppleBasket = 1}) end
local function Door() setVisibility(door, {Door = 1}) task.wait(1.5) setVisibility(door, {Door = 0}) end
local function TweenStart() createTween(appleHand, {Transparency = 1}, 2):Play() end
local function SwordArmOn() setVisibility(ousRig, {SwordArm1 = 0, SwordArm2 = 0, SwordArm3 = 0, SwordHorse1 = 1, SwordHorse2 = 1, Swordhorse3 = 1}) end
local function SwordArmOff() setVisibility(ousRig, {SwordArm1 = 1, SwordArm2 = 1, SwordArm3 = 1}) end

-- Start ousRig Anim
local function startOusRigAnim()
	local humanoid = ousRig:FindFirstChildOfClass("Humanoid")
	if not humanoid then
		warn("Humanoid not found in rig")
		return
	end

	local animation = Instance.new("Animation")
	animation.AnimationId = "rbxassetid://18685004462" -- SwordCollect animation ID
	local animTrackSwordCollect = humanoid:LoadAnimation(animation)
	animTrackSwordCollect.Priority = Enum.AnimationPriority.Action
	animTrackSwordCollect:AdjustSpeed(1)

	-- Define the animation events
	local events = {
		["AppleHand"] = AppleHand,
		["Door"] = Door,
		["TweenStart"] = TweenStart,
		["SwordArmOn"] = SwordArmOn,
		["SwordArmOff"] = SwordArmOff
	}

	for eventName, eventFunc in pairs(events) do
		local signal = animTrackSwordCollect:GetMarkerReachedSignal(eventName)
		signal:Connect(eventFunc)
	end

	animTrackSwordCollect:Play()
end

-- Function to move the rig to a position while maintaining its orientation
local function moveToPosition(target, targetPosition, speed)
	local distance = (targetPosition - target.Position).magnitude
	local duration = distance / speed

	local currentOrientation = target.CFrame - target.Position
	local targetCFrame = CFrame.new(targetPosition) * currentOrientation

	local tween = createTween(target, {CFrame = targetCFrame}, duration)
	tween:Play()
	tween.Completed:Wait()
end

-- Function to move the horse to the waypoints and goal
local function moveToGoal()
	local firstWaypointPosition = waypoints[1].Position
	local directionToFirstWaypoint = (firstWaypointPosition - startPosition).unit
	local startOrientation = CFrame.new(startPosition, startPosition + directionToFirstWaypoint)
	swordHorse:SetPrimaryPartCFrame(startOrientation)

	for i, waypoint in ipairs(waypoints) do
		local waypointPosition = waypoint.Position
		moveToPosition(swordHorse.PrimaryPart, waypointPosition, speed)

		if (swordHorse.PrimaryPart.Position - waypointPosition).magnitude > 1 then
			warn("Did not reach waypoint " .. i .. ". Current position:", swordHorse.PrimaryPart.Position)
			return
		end

		local nextTargetPosition = (waypoints[i + 1] and waypoints[i + 1].Position) or goalPosition
		local targetOrientation = CFrame.new(waypointPosition, nextTargetPosition)
		swordHorse:SetPrimaryPartCFrame(targetOrientation)
		-- Check for the correct Waypoint to start the Animation
		if i == 24 then -- Start Animation at IDX 24 == Waypoint 24
			startOusRigAnim()
		end

	end

	moveToPosition(swordHorse.PrimaryPart, goalPosition, speed)

	if (swordHorse.PrimaryPart.Position - goalPosition).magnitude > 1 then
		warn("Did not reach the goal. Current position:", swordHorse.PrimaryPart.Position)
		return
	end
end

-- Function to move the horse to the waypoints and back to start
local function moveToStart()
	local lastWaypointPosition = waypoints[#waypoints].Position
	local directionToLastWaypoint = (lastWaypointPosition - goalPosition).unit
	local startOrientation = CFrame.new(goalPosition, goalPosition + directionToLastWaypoint)
	swordHorse:SetPrimaryPartCFrame(startOrientation)

	for i = #waypoints, 1, -1 do
		local waypointPosition = waypoints[i].Position
		moveToPosition(swordHorse.PrimaryPart, waypointPosition, speed)

		if (swordHorse.PrimaryPart.Position - waypointPosition).magnitude > 1 then
			warn("Did not reach waypoint " .. i .. ". Current position:", swordHorse.PrimaryPart.Position)
			return
		end

		local nextTargetPosition = (waypoints[i - 1] and waypoints[i - 1].Position) or startPosition
		local targetOrientation = CFrame.new(waypointPosition, nextTargetPosition)
		swordHorse:SetPrimaryPartCFrame(targetOrientation)
	end

	moveToPosition(swordHorse.PrimaryPart, startPosition, speed)

	if (swordHorse.PrimaryPart.Position - startPosition).magnitude > 1 then
		warn("Did not reach the Start. Current position:", swordHorse.PrimaryPart.Position)
		return
	end
end

-- Coroutine for the horse
local function horseRoutine()
	-- Load and play the first animation for the horse (moving to goal)
	local moveToGoalAnimation = Instance.new("Animation")
	moveToGoalAnimation.AnimationId = "rbxassetid://17181748211" -- Correct animation ID for moving to the goal
	local horseHumanoid = swordHorse:FindFirstChildOfClass("Humanoid")
	if not horseHumanoid then
		warn("Humanoid not found in SwordHorse")
		return
	end

	local moveToGoalAnimTrack = horseHumanoid:LoadAnimation(moveToGoalAnimation)
	moveToGoalAnimTrack.Priority = Enum.AnimationPriority.Action
	moveToGoalAnimTrack:AdjustSpeed(1) -- Adjust speed if necessary
	moveToGoalAnimTrack:Play() -- Start the animation

	-- Move to the goal
	moveToGoal()

	-- Wait until the horse reaches the goal
	while (swordHorse.PrimaryPart.Position - goalPosition).magnitude > 1 do
		task.wait(0.1)
	end

	-- Stop the first animation when reaching the goal
	if moveToGoalAnimTrack.IsPlaying then
		moveToGoalAnimTrack:Stop() -- Stop the animation
	end

	task.wait(5)
	-- Load and play the second animation for the horse (moving back to start)
	local moveToStartAnimation = Instance.new("Animation")
	moveToStartAnimation.AnimationId = "rbxassetid://17181707826" -- Correct animation ID for moving to the start
	local moveToStartAnimTrack = horseHumanoid:LoadAnimation(moveToStartAnimation)
	moveToStartAnimTrack.Priority = Enum.AnimationPriority.Action
	moveToStartAnimTrack:AdjustSpeed(2.3) -- Adjust speed if necessary
	moveToStartAnimTrack:Play() -- Start the animation

	-- Move back to the start
	moveToStart()

	-- Wait until the horse returns to the start
	while (swordHorse.PrimaryPart.Position - startPosition).magnitude > 1 do
		task.wait(0.1)
	end

	-- Stop the second animation when reaching the start
	if moveToStartAnimTrack.IsPlaying then
		moveToStartAnimTrack:Stop() -- Stop the animation
	end

	-- Wait before the next cycle
	task.wait(5)
end

-- Event functions
local function event1() setVisibility(blacksmithModel, {TongsRock = 1, TongsHand = 0, Lump = 0, HammerRock = 1, HammerHand = 0, SwordRock1 = 1, SwordRock2 = 1, SwordRock3 = 1, SwordAnvil = 1, SwordHand = 1, SwordPack1 = 1, SwordPack2 = 1, SwordPack3 = 1}) end
local function event2() local lump = blacksmithModel:FindFirstChild("Lump", true) local swordAnvil = constructionFolder:FindFirstChild("SwordAnvil", true) if lump and swordAnvil then createTween(lump, {Transparency = 1}, 2):Play() createTween(swordAnvil, {Transparency = 0}, 2):Play() end end
local function event2B() local lump = blacksmithModel:FindFirstChild("Lump", true) local swordAnvil = constructionFolder:FindFirstChild("SwordAnvil", true) if lump and swordAnvil then lump.Transparency = 1 swordAnvil.Transparency = 0 end end
local function event3() setVisibility(blacksmithModel, {HammerRock = 0, HammerHand = 1}) end
local function event4() setVisibility(blacksmithModel, {TongsRock = 0, TongsHand = 1}) end
local function event5() setVisibility(blacksmithModel, {SwordAnvil = 1, SwordHand = 0}) end
local function event6() setVisibility(blacksmithModel, {SwordHand = 1, SwordRock1 = 0}) end
local function event7() setVisibility(blacksmithModel, {TongsRock = 1, TongsHand = 0}) end
local function event8() setVisibility(blacksmithModel, {Lump = 0}) end
local function event9() setVisibility(blacksmithModel, {TongsRock = 1, TongsHand = 0, Lump = 0, HammerRock = 1, HammerHand = 0, SwordRock1 = 0, SwordRock2 = 1, SwordRock3 = 1, SwordAnvil = 1, SwordHand = 1, SwordPack1 = 1, SwordPack2 = 1, SwordPack3 = 1}) end
local function event10() setVisibility(blacksmithModel, {SwordHand = 1, SwordRock2 = 0}) end
local function event11() setVisibility(blacksmithModel, {TongsRock = 1, TongsHand = 0, Lump = 0, HammerRock = 1, HammerHand = 0, SwordRock1 = 0, SwordRock2 = 0, SwordRock3 = 1, SwordAnvil = 1, SwordHand = 1, SwordPack1 = 1, SwordPack2 = 1, SwordPack3 = 1}) end
local function event12() setVisibility(blacksmithModel, {SwordHand = 1, SwordRock3 = 0}) end
local function event13() setVisibility(blacksmithModel, {SwordPack1 = 0, SwordPack2 = 0, SwordPack3 = 0, SwordRock1 = 1, SwordRock2 = 1, SwordRock3 = 1}) end
local function event14() setVisibility(blacksmithModel, {SwordPack1 = 1, SwordPack2 = 1, SwordPack3 = 1, SwordHorse1 = 0, SwordHorse2 = 0, SwordHorse3 = 0})
	horseRoutine()
end
local function anchorRig() blacksmithModel.PrimaryPart.Anchored = true end
local function unanchorRig() blacksmithModel.PrimaryPart.Anchored = false end

-- Blacksmith routine using GetMarkerReachedSignal
local function blacksmithRoutine()
	local markersAndEvents = {
		{ marker = "Event1", event = event1 },
		{ marker = "Event2", event = event2 },
		{ marker = "Event2B", event = event2B },
		{ marker = "Event3", event = event3 },
		{ marker = "Event4", event = event4 },
		{ marker = "Event5", event = event5 },
		{ marker = "Event6", event = event6 },
		{ marker = "Event7", event = event7 },
		{ marker = "Event8", event = event8 },
		{ marker = "Event9", event = event9 },
		{ marker = "Event10", event = event10 },
		{ marker = "Event11", event = event11 },
		{ marker = "Event12", event = event12 },
		{ marker = "Event13", event = event13 },
		{ marker = "Event14", event = event14 },
		{ marker = "AnchorRig", event = anchorRig },
		{ marker = "UnanchorRig", event = unanchorRig }
	}

	task.wait(1)

	for _, entry in ipairs(markersAndEvents) do
		local markerSignal = animTrack:GetMarkerReachedSignal(entry.marker)
		markerSignal:Connect(entry.event)
	end

	animTrack:Play()
end

-- Start the routines
blacksmithRoutine()

The missing parts of the script, specifically, are all of these:

-- ousRig parts
local appleHand = ousRig.RightHand:FindFirstChild("AppleHand")
local appleBasket = ousRig:FindFirstChild("AppleBasket")
local door = workspace.FightArea.Armoury.Building.Doorway.Door:FindFirstChild("Door")
local swordArm1 = ousRig.RightHand:FindFirstChild("SwordArm1")
local swordArm2 = ousRig.RightHand:FindFirstChild("SwordArm2")
local swordArm3 = ousRig.RightHand:FindFirstChild("SwordArm3")
local swordHorse1 = construction.SwordHorse.SwordsOnHorse:FindFirstChild("SwordHorse1")
local swordHorse2 = construction.SwordHorse.SwordsOnHorse:FindFirstChild("SwordHorse2")
local swordhorse3 = construction.SwordHorse.SwordsOnHorse:FindFirstChild("SwordHorse3")

The Swords are all copied from one starting sword, just duplicated and renamed. They all work perfectly within the Blacksmith animation and the Horse.
The Door works, I already have a script running for players to be able to click to open, which in turn changes the transparency for them to walk through so I know that works.
The Apples have no reason not to work…

I added a separate script JUST to search through the rig for the “AppleBasket”.
This screenshot shows AppleBasket cannot be found.
While the Explorer and Properties in the same screenshot show AppleBasket parented to the rig as defined.

If it was one thing missing, I’d chalk it up to a Studio oops and figure a way around it, but this is just WEIRD.
These parts are parented in different places within the explorer, at different levels, and I’ve used multiple other parts as seen in the script, from various places in the explorer and they’re all working fine.

What the heck is happening here??

Here’s the door:

Here’s the swords in the horse:

Swords and AppleHand in the rig:

I’m at a complete loss. I’ve been working on this for a week, it all works, and my last hurdle is non-existent parts that clearly exist…?

1 Like