hey there, i’m working on a test world, I have two tools, one of them makes new parts, then the seconds destroys them, first I went with this for the delete tool:
local Workspace = game:GetService("Workspace")
local Tool = script.Parent
local function Clicked()
Part = Workspace:WaitForChild("Part")
end)
Tool.Activated:Connect(function()
this worked, but I wanted to give the player to have the option to delete the part of their choice, like in build tools
so I came up with this
local Tool = script.Parent
local Workspace = game:GetService(“Workspace”)
Tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if mouse.target == workspace.Part then
print(mouse.Target)
mouse.Target:Destroy()
end
end)
end)
One immediate issue with this, is that this will not replicate across the client-server boundary. You would need to perform these actions on the server after handling the input on the client e.g. instantiating parts or removing them.
Also, I’m slightly confused by your equals operation:
if mouse.Target == workspace.Part then
Surely if one of the tools creates a new part, that Part may differ from the one you’re referencing with workspace.Part - you should instead check to see if it matches any other criteria e.g. a name, or a value as a child of the part that determines who placed that block.
okay, now I need more help, when I test the game, my mouse disappears from the test screen so I can’t see where it is, I have been messing around with changing the mouses image, but I removed that script now.