I want to make only one garage be the player’s garage
All of the garages named EmptyGarage will turn into the player’s garage (I understand why it does, I just don’t know how to fix it)
I have tried fixing it but it just kept messing with me
game.Players.PlayerAdded:Connect(function(plr)
for i, garage in pairs(script.Parent:GetChildren()) do
if garage.Name == "EmptyGarage" then
garage.Name = plr.Name
garage.Player.Value = plr.Name
garage.CarModel.Car.Name = plr.Name.."Car"
garage.Roof.SurfaceGui.StatusLabel.Text = plr.Name.."'s Garage"
garage.Roof.SurfaceGui.StatusLabel.BackgroundColor3 = Color3.new(0, 255, 0)
end
end
end)
local EmptyGarage = script.Parent:FindFirstChild("EmptyGarage")
if EmptyGarage then -- If there is a garage existing, can use: if EmptyGarage ~= nil then
--Code here
end