I’m Making a car game and it is done and tested, getting ready to release but I found this issue, when i go right up against a wall the car spawns through the wall, how would I check if there is a wall and not spawn the car
Here is the spawn script as well as a video with an example
function spawnCar(player, carName)
local playerCars = DataStores:LoadModels(player)
if table.find(playerCars, carName) then
if spawnedCars[player] then
local existingCar = spawnCarFolder:FindFirstChild(spawnedCars[player])
if existingCar then
local seat = existingCar:FindFirstChild("DriveSeat")
if seat.Occupant then
seat.Occupant.Sit = false
wait(0.5)
existingCar:Destroy()
else
existingCar:Destroy()
end
end
end
local humanoidRootPart = player.Character.HumanoidRootPart
local clonedCar = carFolder[carName][carName]:Clone()
clonedCar.Parent = spawnCarFolder
clonedCar.Name = player.Name.."'s "..carName
clonedCar:PivotTo(player.Character:GetPivot() * CFrame.new(0, 10, -15))
spawnedCars[player] = clonedCar.Name
delay(1, function()
clonedCar.DriveSeat:Sit(player.Character.Humanoid)
end)
end
end
robloxapp-20230703-1352204.wmv (4.9 MB)