I have a script which spawns a train from ServerStorage if the region is empty. However, even if its not empty it still spawns it for some reason.
bin = script.Parent
local SS = game:GetService("ServerStorage")
local train = SS.C153Bay1
--[[
local train2 = SS.C153Bay2 ID = 2
local train3 = game.ServerStorage.C153Bay3 ID = 3
local train4 = game.ServerStorage.C153Bay4 ID = 4
local train5 = game.ServerStorage.C153Bay5 ID = 5
local train6 = game.ServerStorage.C153Bay6 ID = 6
]]--
function Clicked(player)
if workspace:IsRegion3Empty(Region3.new(Vector3.new(1275.698, 4.344, -2870.501), Vector3.new(1270.9, 13.454, -2792.334))) then
print("Region Clear")
local clone = train:clone()
clone.Parent = workspace
clone:MakeJoints()
else
script.Parent.Text = "Region Occupied"
wait(2)
script.Parent.Text = "Class 153 Single Unit"
end
end
bin.MouseButton1Down:connect(Clicked)
