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.
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
DestroyGate(Barrier)
end
end
That would make more sense (in terms of efficiency and organization).
Thank you i understand much better now
Thankyou for helping i understand much better now
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.
Okay thanks for the tip ill remember it