local player = game:GetService('Players').LocalPlayer
local mouse = player:GetMouse()
local uis = game:GetService("UserInputService")
local isDrawing = false
local startPos
local endPos
mouse.Button1Down:Connect(function()
if mouse.Target and mouse.Target:IsA("Part") then
startPos = mouse.Hit.Position
isDrawing = true
end
end)
mouse.Move:Connect(function()
if isDrawing then
endPos = mouse.Hit.Position
end
end)
mouse.Button1Up:Connect(function()
if isDrawing then
isDrawing = false
if endPos then
local region = Region3.new(startPos, endPos)
game.Workspace:FindPartsInRegion3(region, nil, math.huge):Destroy()
end
end
end)
mouse.KeyDown:Connect(function(key)
if key == "t" then
isDrawing = true
end
end)
mouse.KeyUp:Connect(function(key)
if key == "t" then
isDrawing = false
if endPos then
local region = Region3.new(startPos, endPos)
game.Workspace:FindPartsInRegion3(region, nil, math.huge):Destroy()
end
end
end)
I want to make it so that when a player pressed T, and entered the mouse cursor, he could circle the inside of an object, and this circled part would be deleted, but I can not do it, please help me.