You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? So i have this code which was meant to do basic PartInsidePart stuff, To make sure my furniture is not in another one, And i move the furniture using TweenService to set primary part CFrame
-
What is the issue? It doesn’t trigger and doesn’t get a part which i called HitBox, I’ve try print it,It doesn’t even print the HitBox Part, But for other part it does, Even when i dont use tween service, It still wont print it
-
What solutions have you tried so far? Try using GetPartInBox, Same result also theres no Overlap param what so ever
local function tweenModel(model, CF)
if model == nil or model.PrimaryPart == nil then return end
if model.PrimaryPart == nil then return end
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = model:GetPrimaryPartCFrame()
local connection = CFrameValue:GetPropertyChangedSignal("Value"):connect(function()
if model == nil or model.PrimaryPart == nil then return end
model:SetPrimaryPartCFrame(CFrameValue.Value)
end)
local tween = tweenService:Create(CFrameValue, info, {Value = CF})
tween:Play()
tween.Completed:connect(function()
CFrameValue:Destroy()
connection:disconnect()
end)
--coroutine.yield()
end
game["Run Service"].Heartbeat:Connect(function()
if currentFurniture ~= nil then
currentFurniture.HitBox.Transparency = 1
local cf = CFrame.new(postogrid(mouse.Hit.p)) * CFrame.Angles(0,math.rad(rotationIndex*45),0)
--tweenModel(currentFurniture,cf)
currentFurniture:SetPrimaryPartCFrame(cf)
local p = workspace:GetPartBoundsInBox(currentFurniture.HitBox.CFrame,currentFurniture.HitBox.Size)
local hiboxed = false
for _,v in pairs(p) do
print(v.Name)
if v.Name == "HitBox" and v.Parent ~= currentFurniture then
hiboxed = true
currentFurniture.HitBox.Color = Color3.new(1,0,0)
currentFurniture.HitBox.Transparency = 0.4
print("aabb collision detected")
break
end
end
coroutine.yield()
end
end)