CanQuery always set to true with Humanoids

Im making a block placing system, and one of the blocks that you can use to place is a dummy (with a humanoid).

The problem is that when I set can query for a humanoid model to off, it sets itself to true again.

Is it just me? If not, someone please help. Thanks!

1 Like

Can you show the code where you’re raycasting down to find the position?

i = mouse.Move:Connect(function()
		if part:IsA("BasePart") then
		task.wait()
		part.Position = mouse.Hit.Position
		local X = math.round(part.Position.X)
		local Y = math.round(part.Position.Y) + 0.75
		local Z = math.round(part.Position.Z)

		if part.Size.Y % 2 ~= 0 --[[odd]] then
			X = math.round(part.Position.X) + 0.5
			Z = math.round(part.Position.Z) + 0.5
		end


		if part.Position ~= Vector3.new(X,Y,Z) then
				part.Position = Vector3.new(X,Y+(part.Size.Y/2)- 1 --[[prevent stud rounding from messing things up]] ,Z)
		end

		elseif part:IsA("Model") then
			task.wait()
			local X = math.round(mouse.Hit.Position.X)
			local Y = math.round(mouse.Hit.Position.Y) + 0.75
			local Z = math.round(mouse.Hit.Position.Z)
			
			if part:GetExtentsSize().Y % 2 ~= 0 --[[odd]] then
				X = math.round(mouse.Hit.Position.X) + 0.5
				Z = math.round(mouse.Hit.Position.Z) + 0.5
			end




			if part:GetPivot().Position ~= Vector3.new(X,Y,Z) then
				part:MoveTo(Vector3.new(X,Y+(part:GetExtentsSize().Y/2) - 1,Z))
			end
		end
	end)

/// can query setter

if part:IsA("BasePart") then
		part.CanCollide = false
		part.CanQuery = false
		part.Transparency = 0.5
		part.Anchored = true
		part.Name = "Ghost_"..part.Name
	elseif part:IsA("Model") then
		part.Name = "Ghost_"..part.Name
		for i, item in ipairs(part:GetDescendants()) do
			task.wait(0.015) -- wait time based off of amt of parts
			if item:IsA("BasePart") then
				item.CanCollide = false
				item.CanQuery = false
				item.Transparency = 0.5
				item.Anchored = true
			end
		end
	end
	part.Parent = workspace.GhostParts
	script.select.Adornee = part
	gui.LoadImage.Visible = false
	script.Loading.Value = false 

I know this post was a while ago, but have you found a solution?

Adding the humanoid into the exclude list for the raycast.