The booth model on the other side is a copy and paste of this booth model, so everything is the same, including the script.
As you can see, Get PartsInPart ignores even though it’s different models and includes parts.
So I want to use OverlapParams to make parts are not included if it’s different models.
local toolEvent = ReplicatedStorage:WaitForChild("ToolEvent")
toolEvent.OnServerEvent:Connect(function(player, target, newCFrame)
local originPosition = target.Position
local testpart = TierModel.testpart
if target and newCFrame then
local partName = target.Name
local playerValue = player:FindFirstChild(partName)
if playerValue == nil then
return false
end
if target.Name ~= playerValue.Name then
return false
end
local originalCFrame = target.Position
if target.Locked then
return false
end
target.Position = newCFrame
local params = OverlapParams.new()
params.FilterDescendantsInstances = {target}
params.FilterType = Enum.RaycastFilterType.Include
local partsInTestPart = workspace:GetPartsInPart(testpart, params)
local targetIncluded = false
for _, part in ipairs(partsInTestPart) do
if part == target then
targetIncluded = true
break
end
end
if not targetIncluded then
target.Position = originalCFrame
end
end
end)
But I have no idea how to use OverlapParams.
I did this for now… it doesn’t work. Still other models include parts.
Can you solve this problem? please…