#It says that the parameter is nil even though it exists on both the client and server

279 messages · Page 1 of 1 (latest)

neon folio
#

the code is gonna be under this since the code is in a textfile

#

I would recommend expanding the file, because it looks a little goofy if you don't

neon folio
#

I mean fully viewing it

dense saffron
#

which parameter

neon folio
#

part

#

anyways

#

I just found the issue

dense saffron
#

ok

neon folio
#

The part that I make on the server doesn't replicate in the time it takes for RemoteEvent on the client to receive :OnClientEvent

#

😭

dense saffron
#

oh

neon folio
#

I might ask a question later

dense saffron
#

okay

neon folio
#

gotta go get mickey d's

neon folio
#

anyways how would I make sure that part exists on the client after the clients receives the remote?

dense saffron
#

Pass the instance in the event and check if workspace.part == passedPart

#

Or if passed part then...

neon folio
#

it's not really like only one of the part that exists will be named part

#

or "Handle" as I named it

#

sorry for not responding 💀

dense saffron
#

Yeah == compares instances

#

Not name

neon folio
#

well I mean it doesn't exist at the time of running it

#

so I gotta make sure it exists first or else nothing really happens

#

anyways if I were to do if workspace.part == passedPart nothing would happen because passedPart doesn't exist for the client yet

#

and this would happen for every new part I would have to make

dense saffron
#

No I corrected that

neon folio
#

really?

dense saffron
#

Use if workspace:FFC(passedpart) instead

neon folio
#

isn't the argument for findfirstchild a string?

#

I'll try it anyways

dense saffron
#

O yeah

neon folio
#

yeah it says missing argument

dense saffron
#

Forgot bout that

#

U could just use Wait for child then

neon folio
#

doesn't that also use a string?

dense saffron
#

Yeah

neon folio
#

I'll try it

dense saffron
#

But you could pass the name of the part

neon folio
#

I'll try

#

It still says that part is nil

dense saffron
neon folio
#

error "attempt to index part with nil"

#

do you have beef with my code problem 😭?

dense saffron
#

No I thought it would be an easy fix

#

Lol

neon folio
#

yeah

#

😦

dense saffron
#

I have an idea

neon folio
#

yeah?

dense saffron
#
local try
repeat
    try = workspace:WaitForChild(passedName)
    task.wait()
until try == passedPart

neon folio
#

how do I turn on no check for a script?

dense saffron
#

What

neon folio
#

nvm I'll just try that

#

also would I just set try = nil

dense saffron
#

No

#

U could

#

But that would work

neon folio
#

uh

#

alr

dense saffron
#

oops

#

Did It crash 😭

neon folio
#

yeah uh

#

it still errors 😭

dense saffron
#

O

neon folio
#

I asked about nocheck since it turns off type-checking 😭

dense saffron
#

What error

neon folio
#

attempted to index nil with name 😭

dense saffron
#

What

#

Oh

#

Oops

#

Pass the string name

#

Not the instance

neon folio
#

well uhh I forgot to add a wait

dense saffron
#

😭

neon folio
#

well I can't get the part itself so all I have is the name 😭

dense saffron
#

Yeah

#

So pass the name

#

Or I guess you should change it to passedName

neon folio
#

nah I'll just pass both the name and the instance

dense saffron
#

Okay but passing the instance raised an error last time

neon folio
#

yeah but I hope that after the instance's name is checked by the until loop

#

that the instance actually exists

dense saffron
#

wait

#

O yea

#

But

#

That would also raise an error

#

😭 forgot

#

Wait it wouldn't

#

🥴

#

I fixed it 💀

neon folio
#

I think I broke my code 😭

dense saffron
#

uh oh

neon folio
#

wait nvm

#

I put a print into the repeat loop

#

and uhh

#

try NEVER equals to name

dense saffron
#

No

#

try checks the instance of the part

#

but try is defined as wait for child

#

With the name

neon folio
#

how could it ever equal an instance if it's trying to set try as a string?

dense saffron
#

It's not

neon folio
#

really?

dense saffron
#

Wait for child returns an instance

#

But the arg is a string

neon folio
#

hmm yeah

#

but regardless it still isn't working

dense saffron
#

Probably bc there's multiple

loud hollowBOT
#

studio** You are now Level 20! **studio

neon folio
#

nah there's only one part named Handle

dense saffron
#

Is there?

#

Oh

#

That's weird

#

Use the update code and add prints

neon folio
#

I did earlier

#

and I tried again

#

still just keeps on printing

dense saffron
#

Um

#

That's not possible

#

Try printing the passed things

neon folio
#

alr

#

well if I print name, instance it just prints Handle which is the name and nil

dense saffron
#

And nil?

neon folio
#

which I don't understand since the part is LITERALLY on my screen

#

yeah

dense saffron
#

Can you show me the code

#

That fires

neon folio
#

sure

dense saffron
#

Oh

#

It's cuz it's being fired before the instance is created

#

Wait

#

Nevermind I just realized 💀

neon folio
#

I don't think local functions run until they're called though 😭

loud hollowBOT
#

studio** You are now Level 10! **studio

neon folio
#

thanks mee6

dense saffron
#

Can I see the reciveing script

neon folio
#

alr

#

there is some stuff I don't think really matters in the script but here you go

#

the main problem in the repeat loop

#

where it'll never meet the conditions so the rest of the script never runs

#

😭

dense saffron
#

Lol

#

So

#

Handle is being fired as nil, right

neon folio
#

yeah

#

😦

#

but like it should exist on the server 😭

dense saffron
#

Right

#

That's really weird

neon folio
#

because if I put a print(instance) in the serverscript

#

it prints

#

completely fine

#

but when I fire it through the remote event

#

it's nil because the part hasn't replicated it yet

dense saffron
#

Idk if that's the problem

#

Try calling the fire function without task.delay

#

And on server event, add a task.wait(5) or something

#

Just to see if it ever gets replicated

#

Or if something else is causing this

neon folio
#

I mean

#

task.delay would work the same way as you're saying

#

but I got you

dense saffron
#

at this point u just gotta try everything ¯_(ツ)_/¯

neon folio
#

yeah it works

#

both with task.delay

#

and task.wait(5) + HandleSpawn()

dense saffron
#

No I meant

neon folio
#

this replication problem is beating my ass man

dense saffron
#

Call it normally but add a wait in the recieving function

neon folio
#

the receiving function?

#

alr

dense saffron
#

Then instead of referencing the handle from the arguments, do print(workspace.Handle)

dense saffron
neon folio
#

well now it's stuck again

#

😭 what the hell is going on

dense saffron
#

Wdym

#

Comment out the repeat

#

I just wanna know if the handle ever gets replicated or if it's another issue

neon folio
#

without the repeat loop

#

it works? 😭

dense saffron
#

Yeah

#

It's just slow then

neon folio
#

yeah I know

dense saffron
#

Now try the same thing but only change the reference

#

Instead of workspace.Handle use the passed Handle

neon folio
#

it works

#

😄

#

i'll try removing the wait

dense saffron
#

With the wait 5?

neon folio
#

and see what happens

dense saffron
#

Oh

#

Ok

neon folio
#

😮

#

it works

#

that's all I needed? 😭

dense saffron
#

o

#

Is there a reason you use delay

#

Instead of calling normally

#

Try using spawn(function, false)

#

I don't remember if the second param is a number or bool

#

But 0 or false

neon folio
#

I was tryna see if it was firing the remote before handle existed

dense saffron
#

Was it?

neon folio
#

but now that I found the problem I shouldn't need task.delay or task.spawn

#

no

dense saffron
#

Oh

neon folio
#

it was ENTIRELY a replication problem

#

because when the client receives the remote Handle doesn't exist yet so it errors and ruins my day

dense saffron
#

💀

neon folio
#

the server was lil slow in replicating

#

💀

#

that was the entire problem

dense saffron
#

Lua is interpreted right?

#

How tf does that work

neon folio
#

there's delay when the server replicates the existence of a part

dense saffron
#

Well anyway glad it's fixed

neon folio
#

thanks bro

#

but the solution was so simple but it took multiple hours

#

😭

dense saffron
#

Np

dense saffron
neon folio
#

it was beating the shit out of me though

dense saffron
#

That's not what I meant

neon folio
#

Imma try to finish up this script and see if there's any more errors

dense saffron
#

But wtvr have fun 🥲

neon folio
#

ok

#

😭

#

nvm everything is going wrong again

dense saffron
#

yay

neon folio
#

man I give up

#

I just put task.delay for 0.05

#

and it works

#

I can't be totally accurate and proud of it anymore 😭

#

but

#

it works

dense saffron
#

Lol

neon folio
#

it's kinda slapped together but it works

dense saffron
#

Does calling it normally not work?

neon folio
#

I would have to add a task.wait for an appropriate amount of time

dense saffron
#

Why

#

No u dont

#

Don't bow to the compliers will

#

Make the compiler bow down to u

neon folio
#

I don't even know what to do

#

since server to client replication is based on the client's internet

#

so someone who is incredibly laggy might not get the replication in 0.05 seconds

#

😭

dense saffron
#

Yeah that's when you probably have to use something to wait for it

#

I can't think of something off the top of my head

neon folio
#

also I the repeat loop would not work

dense saffron
#

I can try when I get home but I'm not at my PC rn

neon folio
#

ok

#

the repeat loop would not work because the Handle parameter is nil when it is received, so all I'm doing is setting try == nil 😭

dense saffron
#

I don't understand how it's nil 🫥

#

But ok

#

U could serialize it

neon folio
#

what's serializing?

dense saffron
#

Idk it sounds cool

#

From what I know, it's making data into a Jason

#

Json

#

But idk how to

#

Let's ask the Roblox ai

neon folio
#

for me it just looks like turning info into a table

#

which can be then read and then turned back into it's original info

dense saffron
#

Yeah except it's characters instead of a table

#

I think