I'm trying to make a part where when a person touches the brick neon bricks are created round the brick. I'm currently stuck on how I'm suppose to get the Brick's Front, Back, Right, Left Position. Brick.Position only gives the center of the brick. so if anyone knows the method can you please tell me. Also this is the script I made for visualization.
local debounce = false
local Part = script.Parent
script.Parent.Touched:Connect(function()
if debounce == false then
debounce = true
print("Hmm")
local PartPos = script.Parent.Position
local NPart = game.Workspace.NeonPart
local CNPart = NPart:Clone()
local RightPosition
local RightLeftSize = Vector3.new(0,Part.Size.Y,Part.Size.Z)
local LeftPosition = Vector3.new(Part.Position.X - 2, Part.Position.Y, Part.Position.Z) -- this method doesn't work the way i want it to
local FrontSize
local FrontPosition
local FrontBackSize = Vector3.new(Part.Size.X,Part.Size.Y,0)
local BackPosition = Vector3.new(Part.Position.X, Part.Position.Y, Part.Position.Z) -- neither does this method
for i = 1,2 do
local LeftPart = CNPart:Clone()
local BackPart = CNPart:Clone()
if Part:FindFirstChild("LeftPart") == nil then
LeftPart.Parent = Part
LeftPart.Name = "LeftPart"
LeftPart.Size = RightLeftSize
LeftPart.Position = LeftPosition
end
if Part:FindFirstChild("BackPart") == nil then
BackPart.Parent = Part
BackPart.Name = "BackPart"
BackPart.Size = FrontBackSize
BackPart.Position = BackPosition
end
end
end
wait(5)
Part.LeftPart:Destroy()
Part.BackPart:Destroy()
debounce = false
end)

2 comments
just calculate its position and substract half of the size of the adjacent length of the part
nvm i just used selectionbox