Barrier system for a simulator?

Im currently making a barrier system and what im doing is firing a remote event when the client loads in from the server with the data for how many barriers they have unlocked as the parameters but it just seems unreliable and hacky to me. Is there a better way to do it? I guess what im asking here is what do the big simulators do for barriers/walls?


Can you post a copy of your code?

Using remote events isn’t “hacky” or “unreliable”, in fact, it’s basically the only way to handle server-client communication.

However, the way you handle remote events could be “unreliable”, but there are always ways to fix it.



All the destroygate() function does is remove the part

1 Like

Your code seems fine, as in it works though it can be optimised and cleaned up quite a lot.

I’d recommend storing BarrierData like so

local BarrierData = {
    ["Barrier1"] = false,
    ["Barrier2"] = false,
    ["Barrier3"] = false,
    ["Barrier4"] = false,
    ["Barrier5"] = false,
    ["Barrier6"] = false,

Now to actually destroy the barriers you would do

for Barrier, Unlocked in pairs(BarrierData) do
    if Unlocked == true then
1 Like

That would make more sense (in terms of efficiency and organization).

1 Like

Thank you i understand much better now

Thankyou for helping i understand much better now

1 Like

This is sort of related, but when a player unlocks a Barrier (which I presume they buy) don’t forget to check if they actually have enough cash on the server before changing the relevant Barrier to true.

1 Like

Okay thanks for the tip ill remember it

1 Like