So, I made a code that when you touch it it makes a thin platform inside the part that can be seen. But when I hit it the part position goes to the middle part, how do I make the position of the new part where the player hit but also still in the middle of the part. Picture if you dont understand what I want
https://drive.google.com/file/d/1-5ZNre-w_n84U9tjj4Gg_KXctdjtVZr3/view?usp=sharing
local cooldown = false
script.Parent.Touched:Connect(function(hit)
if cooldown == false then
cooldown = true
local newBreakPart = Instance.new("Part")
newBreakPart.Size = Vector3.new(script.Parent.Size.X + 0.5, 0.25, script.Parent.Size.Z + 0.5)
newBreakPart.CanCollide = false
newBreakPart.Position = script.Parent.Position
newBreakPart.Orientation = script.Parent.Orientation
local weld = Instance.new("WeldConstraint", newBreakPart)
weld.Part0 = newBreakPart
weld.Part1 = script.Parent
if hit.Parent:FindFirstChild("Humanoid") then
script.Parent.BrickColor = BrickColor.new("Lime green")
newBreakPart.Parent = script.Parent
end
wait(2)
script.Parent.BrickColor = BrickColor.new("Medium stone grey")
cooldown = false
end
end)
