-
I’m trying to make an eraser for my drawing game that would detect the paint parts and remove them.
-
I’m trying to use the GetPartBoundsInBox() method using the position and size of the reticle, but it only detects the baseplate.
-
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.