#one remote event breaks another??

1 messages · Page 1 of 1 (latest)

red forge
#

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???

#

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???

young void
#

the logic hurts my brain for no reason

red forge
#

sorry im still learning😭

young void
#

its fine lol

#

let me read

#

can you explain the issue better

red forge
#

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

young void
#

where are your scripts located firstly

reef condor
#

So use task.wait(1) at the top of your local script and see if that fixes the errors of valid instances being nil

reef condor
#

Are you firing something back to the client after doing whatever you need to do in the remote event?

red forge
#

yes

reef condor
#

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

red forge
#

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

reef condor
#

Hey all that matters is it works. I think you'd benefit from learning to make module scripts though for this system

red forge
#

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

reef condor
reef condor
young void
#

variables are non-existent in this script

#

for example

red forge
red forge
young void
# young void variables are non-existent in this script

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

reef condor
#

^ any time you are editing an instance more than 2 times i'd personally make it a variable. Improves readability a lot

tiny frigate
#

Heard of variables?