Try this:
local objects =
{
--TeddyBear
createObject ( 14602, 622.2998, -255.59961, 1085.40002 ),
createObject ( 2164, 599.5, -270.70001, 1080.19995, 0, 0, 90 ),
createObject ( 2164, 599.5, -268.89999, 1080.19995, 0, 0, 90 ),
createObject ( 2164, 599.5, -267.10001, 1080.19995, 0, 0, 90 ),
createObject ( 2164, 599.5, -265.29999, 1080.19995, 0, 0, 90 ),
createObject ( 2202, 599.70001, -261.29999, 1080.09998, 0, 0, 89.979 ),
createObject ( 2202, 599.70001, -263.5, 1080.09998, 0, 0, 89.979 ),
createObject ( 1671, 604.90002, -255.5, 1080.5, 0, 0, 85.289 ),
createObject ( 1671, 601.5, -260.29999, 1080.5, 0, 0, 88.549 ),
createObject ( 1671, 601.5, -263.89999, 1080.5, 0, 0, 88.544 ),
createObject ( 1671, 601.5, -267.29999, 1080.5, 0, 0, 88.544 ),
createObject ( 1671, 601.5, -270.29999, 1080.5, 0, 0, 88.544 ),
createObject ( 1671, 601.5, -251.10001, 1080.5, 0, 0, 88.544 ),
createObject ( 1671, 601.5, -247, 1080.5, 0, 0, 88.544 ),
createObject ( 1671, 601.5, -243.60001, 1080.5, 0, 0, 88.544 ),
createObject ( 1671, 601.5, -240.7, 1080.5, 0, 0, 88.544 ),
createObject ( 2190, 606.5, -254.8, 1080.80005, 0, 359.011, 303.395 ),
createObject ( 2190, 603.20001, -250.7, 1081, 0, 359.006, 303.393 ),
createObject ( 2190, 603.20001, -246.39999, 1081, 0, 359.006, 303.393 ),
createObject ( 2190, 603.20001, -243.3, 1081, 0, 359.006, 303.393 ),
createObject ( 2190, 602.79999, -241.7, 1081, 0, 359.006, 204.849 ),
createObject ( 2190, 602.90002, -261.39999, 1081, 0, 359.006, 205.25 ),
createObject ( 2190, 602.90002, -264.79999, 1081, 0, 359.006, 205.247 ),
createObject ( 2190, 602.90002, -268, 1081, 0, 359.006, 205.247 ),
createObject ( 2190, 603.20001, -269.60001, 1081, 0, 359.006, 297.27 ),
createObject ( 2164, 599.5, -241.3, 1080.19995, 0, 0, 90 ),
createObject ( 2164, 599.5, -243.10001, 1080.19995, 0, 0, 90 ),
createObject ( 2164, 599.5, -244.89999, 1080.19995, 0, 0, 90 ),
createObject ( 2202, 599.70001, -251.2, 1080.09998, 0, 0, 85.297 ),
createObject ( 2202, 599.79999, -249.10001, 1080.09998, 0, 0, 86.476 ),
createObject ( 2164, 599.5, -246.7, 1080.19995, 0, 0, 90 ),
createObject ( 2007, 599.70001, -257.29999, 1080, 0, 0, 90.952 ),
createObject ( 2007, 599.70001, -256.29999, 1080, 0, 0, 90.284 ),
createObject ( 2007, 599.70001, -255.3, 1080, 0, 0, 89.316 ),
createObject ( 2007, 599.70001, -254.3, 1080, 0, 0, 89.313 ),
createObject ( 2007, 599.70001, -253.3, 1080, 0, 0, 89.313 ),
createObject ( 1491, 616.90002, -262.70001, 1080.09998 ),
createObject ( 10184, 625.29999, -263.10001, 1082.59998, 0, 0, 88.99 ),
createObject ( 1705, 622.29999, -240.39999, 1080, 0, 0, 296.718 ),
createObject ( 1705, 622.70001, -248.39999, 1080, 0, 0, 239.952 ),
createObject ( 1705, 622.79999, -245.60001, 1080, 0, 0, 267.633 ),
createObject ( 1705, 622.79999, -244.39999, 1080, 0, 0, 267.632 ),
createObject ( 1705, 622.79999, -243.2, 1080, 0, 0, 267.632 ),
createObject ( 1705, 622.79999, -242, 1080, 0, 0, 267.632 ),
createObject ( 1705, 622.79999, -246.8, 1080, 0, 0, 267.632 ),
createObject ( 1705, 615, -240.89999, 1080, 0, 0, 24.714 ),
createObject ( 1705, 616.40002, -240.39999, 1080, 0, 0, 1.972 ),
createObject ( 1705, 617.59998, -240.39999, 1080, 0, 0, 1.967 ),
createObject ( 1705, 618.79999, -240.39999, 1080, 0, 0, 1.967 ),
createObject ( 1705, 620, -240.39999, 1080, 0, 0, 1.967 ),
createObject ( 14597, 612, -226.2998, 1082, 0, 359.926, 270.441 ),
createObject ( 3093, 613.09998, -239.8, 1081.09998, 0, 0, 269.539 ),
createObject ( 3093, 613.09998, -239.8, 1081.40002, 0, 0, 269.539 ),
createObject ( 3093, 610.09998, -239.8, 1081.40002, 0, 0, 269.539 ),
createObject ( 3093, 611.20001, -239.60001, 1084.09998, 0, 0, 269.539 ),
createObject ( 3093, 611.90002, -239.60001, 1084.09998, 0, 0, 269.539 ),
createObject ( 1997, 624.20001, -251.8, 1080, 0, 0, 270.756 ),
createObject ( 1997, 627.20001, -251.8, 1080, 0, 0, 270.753 ),
createObject ( 1997, 630.09998, -251.8, 1080, 0, 0, 270.753 ),
createObject ( 1997, 633.70001, -251.8, 1080, 0, 0, 270.753 ),
createObject ( 1997, 633.70001, -259.29999, 1080, 0, 0, 270.753 ),
createObject ( 1997, 630.20001, -259.29999, 1080, 0, 0, 270.753 ),
createObject ( 1997, 627.40002, -259.20001, 1080, 0, 0, 270.753 ),
createObject ( 1997, 624.59998, -259.29999, 1080, 0, 0, 270.753 ),
createObject ( 1997, 621.79999, -262, 1080, 0, 0, 270.753 ),
createObject ( 1997, 616.09998, -262, 1080, 0, 0, 270.753 ),
createObject ( 1997, 608.59998, -240.39999, 1080, 0, 1.978, 88.76 ),
createObject ( 1997, 605.09998, -240.39999, 1080, 0, 1.972, 88.759 ),
createObject ( 1997, 614.20001, -263.89999, 1080, 0, 1.972, 181.81 ),
createObject ( 1997, 614.20001, -266.79999, 1080, 0, 1.967, 181.807 ),
createObject ( 1997, 609.70001, -270.79999, 1080, 0, 1.967, 89.098 ),
createObject ( 1491, 608.70001, -235.39999, 1080, 0, 0, 90.059 ),
createObject ( 1491, 608.70001, -226.10001, 1080, 0, 0, 89.49 ),
createObject ( 1491, 615.40002, -235.39999, 1080, 0, 0, 90.055 ),
createObject ( 1491, 615.29999, -226, 1080, 0, 0, 90.055 ),
createObject ( 1998, 672.40002, -182.10001, 1026 ),
createObject ( 1998, 617.09998, -237, 1080, 0, 0, 90.38 ),
createObject ( 1998, 615.90002, -223.8, 1080, 0, 0, 0.302 ),
createObject ( 1998, 607, -222.89999, 1080, 0, 0, 269.963 ),
createObject ( 1998, 608.09998, -236, 1080, 0, 0, 181.128 ),
createObject ( 2197, 617, -233, 1080, 0, 0, 89.538 ),
createObject ( 2197, 617, -232.3, 1080, 0, 0, 89.533 ),
createObject ( 2197, 617, -231.60001, 1080, 0, 0, 89.533 ),
createObject ( 2197, 617, -230.89999, 1080, 0, 0, 89.533 ),
createObject ( 2197, 617, -229, 1080, 0, 0, 89.533 ),
createObject ( 2197, 617, -228.3, 1080, 0, 0, 89.533 ),
createObject ( 2197, 617, -227.60001, 1080, 0, 0, 89.533 ),
createObject ( 2197, 617, -226.89999, 1080, 0, 0, 89.533 ),
createObject ( 2197, 607.29999, -229.10001, 1080, 0, 0, 270.035 ),
createObject ( 2197, 607.29999, -228.39999, 1080, 0, 0, 270.033 ),
createObject ( 2197, 607.29999, -227.7, 1080, 0, 0, 270.033 ),
createObject ( 2197, 607.29999, -227, 1080, 0, 0, 270.033 ),
createObject ( 2197, 607.29999, -231, 1080, 0, 0, 270.033 ),
createObject ( 2197, 607.29999, -231.7, 1080, 0, 0, 270.033 ),
createObject ( 2197, 607.29999, -232.39999, 1080, 0, 0, 270.033 ),
createObject ( 2197, 607.29999, -233.10001, 1080, 0, 0, 270.033 ),
createObject ( 3383, 624.79999, -233.89999, 1080, 0, 0, 90.223 ),
createObject ( 3383, 624.79999, -225.60001, 1080, 0, 0, 90.22 ),
createObject ( 3383, 599.40002, -233.89999, 1080, 0, 0, 270.645 ),
createObject ( 3383, 599.29999, -226, 1080, 0, 0, 270.643 ),
createObject ( 1806, 616.90002, -236.2, 1080, 0, 0, 91.515 ),
createObject ( 1806, 616.70001, -223.7, 1080, 0, 0, 359.995 ),
createObject ( 1806, 607.09998, -223.8, 1080, 0, 0, 268.83 ),
createObject ( 1806, 607.20001, -236.3, 1080, 0, 1.978, 181.564 ),
createObject ( 2010, 615.09998, -248.5, 1080.09998 ),
createObject ( 2010, 614.70001, -239.10001, 1080.09998 ),
createObject ( 2010, 619, -249.3, 1080.09998 ),
createObject ( 2010, 615.09998, -244.7, 1080.09998 ),
createObject ( 2010, 609.70001, -239.10001, 1080.09998 ),
createObject ( 14604, 620, -230.5, 1081, 0, 0, 179.917 ),
createObject ( 14604, 604.40002, -230.5, 1081, 0, 0, 179.912 ),
createObject ( 14604, 620, -229.3, 1081, 0, 0, 0.549 ),
createObject ( 14604, 604.5, -229.3, 1081, 0, 0, 0.544 ),
createObject ( 2315, 618.40002, -244, 1080, 0, 0, 269.62 ),
createObject ( 2813, 618.40002, -245.7, 1080.5 ),
createObject ( 2813, 618.40002, -243.89999, 1080.5 ),
createObject ( 1752, 618.20001, -244.7, 1080.5, 0, 0.989, 89.244 ),
createObject ( 1491, 612.79999, -222, 1080, 0, 0, 179.451 ),
createObject ( 2167, 609.70001, -213.2, 1080 ),
createObject ( 2167, 610.59998, -213.2, 1080 ),
createObject ( 2167, 611.5, -213.2, 1080 ),
createObject ( 2167, 612.40002, -213.2, 1080 ),
createObject ( 2167, 613.29999, -213.2, 1080 ),
createObject ( 2167, 614.20001, -213.2, 1080 ),
createObject ( 1768, 609.59998, -221.2, 1080, 0, 0, 90.233 ),
createObject ( 1768, 614.29999, -219.2, 1080, 0, 0, 270.108 ),
createObject ( 1433, 609.59998, -218.2, 1080.19995 ),
createObject ( 1433, 614.20001, -218.2, 1080.19995 ),
createObject ( 2195, 609.59998, -218.2, 1081.30005 ),
createObject ( 2195, 614.29999, -218.2, 1081.30005 ),
createObject ( 2817, 609.70001, -214.89999, 1080 ),
createObject ( 2817, 612.40002, -220.3, 1080, 0, 0, 90.335 ),
createObject ( 2817, 613.09998, -214.89999, 1080 )
}
-- Put them standby for now.
for _, object in ipairs( objects ) do
setElementDimension( object, 65535 )
end
local col = createColSphere(635.24976,-255.57161,1081.03284,50)
local function watchChanges( )
local lpDim = getElementDimension( getLocalPlayer( ) )
local oDim = getElementDimension( objects[1] )
if lpDim > 0 and lpDim ~= oDim and getElementInterior( getLocalPlayer( ) ) == getElementInterior( objects[1] ) then
for _, object in ipairs( objects ) do
setElementDimension( object, lpDim )
end
elseif lpDim == 0 and oDim ~= 65535 then
for _, object in ipairs( objects ) do
setElementDimension( object, 65535 )
end
end
end
addEventHandler( "onClientColShapeHit", col,function( element )
if element == getLocalPlayer( ) then
addEventHandler( "onClientRender", root, watchChanges )
end
end)
addEventHandler( "onClientColShapeLeave", col,function( element )
if element == getLocalPlayer( ) then
removeEventHandler( "onClientRender", root, watchChanges )
end
end)