#What is the problem with remote events that i dont understand

56 messages · Page 1 of 1 (latest)

vocal goblet
#

For some reason whenver i send something through remote events it returns nil it happens so often with me that whenever it happens i get fed up and move on to something else and now i noticed how many of them i left behind heres on:
LocalScript:

SpoilerEvent:FireServer(but)

ServerScript:

SpoilerEvent.OnServerEvent(plr,but)

In the server script the 2nd value is always nil now the plr is plr but the 2nd value is nill and this is what happens in all my other remote events

surreal cape
#

What value do you set on but

stoic kernel
gray saffron
#

but its probably just an example you posted, there is no symptoms of this being the issue

gray saffron
#

yea happens to the best of us xD

vocal goblet
vocal goblet
stoic kernel
vocal goblet
#

So like a string variable but = "String"

stoic kernel
#

then

#

what

vocal goblet
#

So its nill when passed to server idk why and i want to know why

stoic kernel
#

its not

#

its nil

#

if you want you can just do local but = "but" and pass but

#

but like

obtuse rivetBOT
#

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

stoic kernel
#

yk

vocal goblet
#

But is a varaible which conatins a string vaue and i wanna get that value

stoic kernel
#

can u show the code

gray saffron
vocal goblet
vocal goblet
vocal goblet
#

lol

analog dust
#

Quick explanation:

#

When firing an event you don't have to put any arg

#

To server

#

But if you're receiving in the server then you need to put the plr argument

#

otherwise it won't find your custom argument

#

On local its the opposite

#

You need a plr object to fire to local

#

But you don't need the player on receiving in local

#

So it'd look smth like this

#

Server:

#
  Remote:FireServer(arg)
  Remote.OnServerEvent(plr, arg)
#

While in local

#
  Remote:FireClient(plr, arg)
  Remote.OnClientEvent(arg)
gray saffron
analog dust
#

:FireClient() needs a plr arg

#

To work

stoic kernel
#

nvm

gray saffron
analog dust
#

I ment when firing TO the client

#

Not in

gray saffron
#

But you have a client reciever in the same script

analog dust
#

TO

#

...Its not a real scropt

#

Its just an example