New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

[SOLVED] Check if nothing touches the object , then add it to a table?

Asked by 10 days ago
Edited 10 days ago

So jeah. You can kind of imagine it like a GTA Spawn car functionality. So you press on a GUI button to spawn the car and it will spawn the car near you. Now I need to find out how to get the info that nothing is inside one of the parts in my table. Im new with Region3 and this didnt work so I would appreaciate some help :))

This is in a normal Script, ServerscriptService in a remoteevent I am firing from the client.

game.ReplicatedStorage.Events.CarShop.SpawnCar.OnServerEvent:Connect(function(player,carName,carColor)

    local carspawns = game.Workspace.MISC.CarSpawns:GetChildren()

    for i,v in pairs(carspawns) do

        local region =  Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
        local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, player.Character:GetDescendants())

        for _, part in pairs(parts) do
            print("Something is in the way")

        end

    end
end)

EDIT: I researched abit more and found IsRegion3EmptyWithIgnoreList. which gave me the result I wanted.

Answer this question