GetPartBoundsInBox() only detects the baseplate

  1. I’m trying to make an eraser for my drawing game that would detect the paint parts and remove them.

  2. I’m trying to use the GetPartBoundsInBox() method using the position and size of the reticle, but it only detects the baseplate.

  3. I tried detecting the parts using Mouse.Target instead, but it still prints out only the baseplate. I didn’t find answers on the devforum.

My drawing code is incredibly simple, all it does is just send the position of the player’s mouse to the server:

applyEv:FireServer(mouse.Hit.Position, mouse.Target)

And then using these, the server spawns in a part:

local function draw(player, position, target)
	if not target.Parent:FindFirstChildWhichIsA("Humanoid") and target.Name ~= "Handle" then
		local paint = replicatedStorage.Paint:Clone()
		paint.Parent = game.Workspace.Paint:FindFirstChild(player.Name)
		paint.CFrame = CFrame.new(position)
	end
end

Now, the erasing code is functioning simmiliarly. It sends the value of the position and the size of the reticle and relays it over to the server:

eraseEV:FireServer(reticle.CFrame, reticle.Size)

And the server is supposed to use those to find the touching paint parts, but it only detects the baseplate and the spawn location, and doesn’t find the paint parts:

local function erase(player, cframe, size)
	local detected = game.Workspace:GetPartBoundsInBox(cframe, size)
	print(detected)
end

I don’t really know what is going on, I would really appreciate some help.

1 Like

I’m not sure about :GetPartBoundsInBox, but for Mouse.Target, if the cloned part “Paint” in ReplicatedStorage has CanCollide and CanQuery turned off then it will not be detectable for Mouse.Target, or any sort of Raycasts.

I assume you have CanCollide off so player’s aren’t walking on the pieces of paint, but if CanQuery is also turned off then it won’t be detectable by a decent number of Roblox systems.

1 Like

I did infact have CanQuery turned off and that did solve the detecting issue!

1 Like

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