#remote event not being received by client from server when first loading data

1 messages · Page 1 of 1 (latest)

raven pollen
#


repStor.data.Inventory.OnClientEvent:Connect(function(inv)
    updateInv(inv)
    print('hai')
end)
#

this problem only happens in actual games, not in studio

tame snow
#

Did you fire the remote?

raven pollen
#

yes

#

i have another local script thats recieves it too

#

that one actually gets it tho

#

i think

ionic atlas
#

it could be a issue with updateInv

raven pollen
#

ok

#

naw it doesnt get it

ionic atlas
strong birchBOT
#

studio** You are now Level 4! **studio

raven pollen
#

yeah

#

it isnt getting it

ionic atlas
#

have you tried

repStor:WaitForChild("data").Inventory.OnClientEvent:Connect(function(inv)
    updateInv(inv)
    print('hai')
end)```
#

just waiting for the child

raven pollen
#

ok

ionic atlas
#

making SURE its there

#

if for some reason that still doesnt work put a debug thing like lua print(repStor:WaitForChild("data").Inventory); repStor:WaitForChild("data").Inventory.OnClientEvent:Connect(function(inv) updateInv(inv) print('hai') end)

raven pollen
#

wait for child didnt work, lemme print

ionic atlas
#

and your simply not firing the remote OR you are firing the remote too early

raven pollen
#

it printed inventory

#

maybe the server fires before the script loads?

ionic atlas
#

thats whats happening

#

add a wait before it fires for like 5 seconds and jnust make sure thats the issue

#

before you debug it for a while

raven pollen
#

ok

#

ok it worked

#

how would i pause the script until client loads it?

ionic atlas
#

or you can just have a wait timer

#

its really up to you since theres not an exact function yk

#

unless im stupid and dont know of one 🤷‍♂️

#

you could research stuff like this now that you fixed the issue tho 👍

tame snow
#

Try
if not game:IsLoaded() then
game.Loaded:Wait()
end
This waits until game is loaded

raven pollen
#

ok 👍