How would I make only one model be the player's model out of multiple models?

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)
1 Like

Add break after garage.Roof.SurfaceGui.StatusLabel.BackgroundColor3 = Color3.new(0, 255, 0)
Hope this helps :slight_smile:

I’ll try go and try it out! Thanks!

Thank you very much kind gentleman, it worked

Why not use :FindFirstChild() ?

When it is nil then there’s no empty garages.

I tried something similar, it didn’t work. But thank you for trying to help!

For instance,

local EmptyGarage = script.Parent:FindFirstChild("EmptyGarage")
if EmptyGarage then -- If there is a garage existing, can use: if EmptyGarage ~= nil then
   --Code here
end