How do I debug this

Ahh, I get what he’s trying to say. He’s saying I’m not checking if nhp is nil. He’s saying it as if I “removed” it, but I just misplaced the code from the right order.

The newCFrame should’ve been inside the block of if nhp.

while true do
	local nhp = nearestHumanPos(parent:GetPivot().Position)
	if nhp then
		local newCFrame = CFrame.new(parent:GetPivot().Position, nhp)
		
		AlignPosition.Position = newCFrame.Position
		AlignOrientation.CFrame = newCFrame
	elseif nhp == nil then
	end
	task.wait()
end
2 Likes

Alright, I tried the new one. 0 errors seem to show up, however, the eyeball’s orientation doesn’t change and lock onto targets.

I’d also like to know how to keep the HumanoidRootPart in place of the Welder part using AlignPosition. I have tried to do so, but it has failed. The eyeball keeps going down to the ground even when there are attachments.

The attachment should be parented to what’s controlling the entire eye, so maybe I should’ve been specific. How’s the properties of the both the AlignOrientation and AlignPosition looking?

AlignPosition and AlignOrientation are parented to HumanoidRootPart.

AlignPosition’s properties at “AlignPosition” are not checked off. For compliance, they are at default settings. For attachments, Attachment0 and 1 are HumanoidRootPart’s attachment.

AlignOrientation, however are at default settings, with the same attachments.

Where should I put the attachments?

You have to set the attachments from TwoAttachments to OneAttachment, it’s not working because it’s expecting two different attachments to work IIRC.

So do I remove one attachment and keep the alignpositions/orientations attaching to that one attachment?

You can do that automatically if you set the properties to OneAttachment on both. The properties should be under AlignmentMode, just change it form TwoAttachment to OneAttachment.

I know that. It’s just now where should I parent AlignPosition and AlignOrientation, and the attachment? Even after being reduced to one attachment, the eyeball except for Welder is still dropping to the floor.

I linked the Roblox documentation in my original post, that’s why the 2 words are blue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.