i have multiple remote events, 1 event is used in a sequence to enter a building, another is used to enter an office
for some reason, whenever i enter the building, some functions that the office remote event starts for some reason breaks?
i playtested it to see what would happen if i just spawned into the building and the office functions worked completely fine???
is there something i dont know abt remote events orr???
#one remote event breaks another??
1 messages · Page 1 of 1 (latest)
heres the things that dont work
closable door and vent
as seen in the corner, they are supposed to drain power of "oxygen"
for some reason the scripts cant find these items in the workspace???
the logic hurts my brain for no reason
sorry im still learning😭
il try
so
the game starts off by the player doing a task, and after that the player enters a building
entering that building activates a remote event
which does a simple blackout and some sound effects mostly
when the player enters the building, theres another task that the player has to do, and after that the player has to enter the office
entering the office also activates a remote event
heres the issue
for some reason, the remote event thats used to enter the building seems to break the remote event that is used to enter the office
because when entering the building, then the office, some scripts in that office seem to break
aka
the "power" and "breath" bar at the bottom right of the screen
where are your scripts located firstly
aside from the fact I personally would never use multiple remote events for core gameplay mechanics such as this, it seems the problem could just be your local script loading too quick which can be common if you aren't waiting to find child
So use task.wait(1) at the top of your local script and see if that fixes the errors of valid instances being nil
il test it
its needed for the gui
Are you firing something back to the client after doing whatever you need to do in the remote event?
yes
I'd recommend switching to a remote function then
You invoke the server, and whatever the server returns it will send back to the script
i got it
i needed to hear myself from a diffrent perspective
so this was the function i had that had the gui "blackout" whenever the player entered the building/office
with the office function at the bottom i had it enable multiple guis that were already enabled, apperantly that caused it to break??😭
no clue how, but if it works, it works
Hey all that matters is it works. I think you'd benefit from learning to make module scripts though for this system
i have been practicing module scripts actually
for future projects i plan on using module scripts much more than remote events, it can get quite messy with events
You should note the two are not doing the same thing in the slightest
A module script on the client side can be edited by exploiters which is something you will need to account for. (same as firing to server, whatever parameters you fire to server a exploiter can)
If you want I can give you some advice on how I'd improve this script
nah ik its just the things in my stuff could be conveted to be modules instead
i plan on only making singleplayer games so it aint gonna be a big problem☺️
the repeated use of script.parent or whatever can be relatively long and repetitive to type out. id do it something like
local Black = script.parent
local BlackFrame = Black.Frame
This would shorten it down to BlackFrame.visible or whatever you need it for
especially later on it can be harder to keep track of all the script.parent stuff and makes your code harder to read
^ any time you are editing an instance more than 2 times i'd personally make it a variable. Improves readability a lot
pretty much sums it up
Heard of variables?