Hello I’m working on a game where I manage houses spawned by users.
Each Neighborhood is a different place to set houses.
Each neighborhood can have between 4 and 9 houses.
Sometimes when some neighborhood are not full of users because they havent been claimed yet, there’s a model called Empty spawning to a future player can come and spawn a house to get it registered in the data store.
So in my server script I use a RemoteEvent to talk to my local script, and when I print both what they send, they don’t show the same result…
In server script :
local function sendHousesInfo(player, x, y)
local houses = getNeighborhoodHouses(x, y)
if houses then
local houseCount = countHouses(houses)
print("HouseManager - I'm sending", houseCount, " - the name of the house model", player.Name)
for houseNumber, houseInfo in pairs(houses) do
print("HouseManager - Sending house:", houseNumber, "Type:", houseInfo.houseType, "Owner:", houseInfo.ownerName)
end
UpdateNeighborhoodHouses:FireClient(player, {
quarterPosition = {
X = x,
Y = y
},
houses = houses
})
end
end
Sorry for the french, yes I like printing in french.
Anyway as you can see, it shows what the server script is gonna send to the client. Houses have a number ID thanks to attributes.
Here the local script receiving :
ReplicatedStorage.UpdateNeighborhoodHouses.OnClientEvent:Connect(function(data)
print("=== Datas received for the neighborhood ===")
print("Neighborhood:", data.quarterPosition.X, data.quarterPosition.Y)
-- Debug: let's see the houses we just received now.
for houseNumber, houseInfo in pairs(data.houses) do
print("House received:", houseNumber, "Type:", houseInfo.houseType, "Owner:", houseInfo.ownerName)
end
local neighborhood = waitForNeighborhood(
data.quarterPosition.X,
data.quarterPosition.Y
)
So we received in total 2 houses (Rip the 7 one)
And the local script will start working with the “Zwei” one.
Later in the prints, it’ll talk about :
But after that, it does other thing and never mentions the 7th House.
UNTIL A WEIRD THING HAPPENS :
I dont have screenshots for now, but believe me, adding the 5th house helped the 7th to be received in local script. 5th appeared too since I made it in the data store.
But without the 5th, the 7th doesn’t come.
If I add the 6th, the 7th doesn’t come too.
So it’s very very weird.