Need help with fixing small script

House numbers are below 4 (4th line in this script)
So basically this script picks random house below 4, :question: how can i change it so it picks random house between 5 and 10? (5, 6, 7, 8, 9 ,10)

local VacantHomes = game.ReplicatedStorage.HomeStats.Vacant:GetChildren()
local AllVacant = {}
for A = 1,#VacantHomes do
	if tonumber(VacantHomes[A].Name) <= 4 then -- Picks random house below 4 (house numbers 1, 2, 3, 4)
		table.insert(AllVacant,VacantHomes[A])
	end
end

How to change 4th line so it picks random house number between 5 and 6

You’d perform the same <= 4 check but >= 5 and <= 10 instead.

1 Like

so i just replace <= 4 with >= 5 <= 10 ?

if tonumber(VacantHomes[A].Name) >= 5 and tonumber(VacantHomes[A].Name) <= 10 then -- Picks random house below 4 (house numbers 1, 2, 3, 4)
1 Like

Got error: Expected identifier when parsing expression, got ‘<=’

Sorry, accidentally did not include the tonumber function, read edited post

1 Like

It works! Thank you so much!!!

1 Like