Categories > Coding > Lua >

Return instance created with arguments (RemoteEvent/RemoteFunction)


New Reply

Whoman

#3561

Posts: 220

Threads: 14

Joined: May, 2022

Reputation: 4

  • 0

Posted

Basically, im trying to create a folder with a remote event it has a parent and name argument but I cant seem to be able to return the instance and remote functions dont support arguments from what I know (sorry for bad portuguese 😔)

https://cdn.discordapp.com/attachments/921902131315875872/973268766895001640/Hello_there.png

 

Whoman#3561 | English & HTML | Learning Lua

RealNickk

am h3x0r

patron Mention

Posts: 3053

Threads: 147

Joined: Feb, 2020

Reputation: 35

  • 0

Replied

Your message is hard to comprehend. Elaborate, I can probably help.

4b5951d5-1b9b-407b-b514-78eb46591564

Whoman

#3561

Mention

Posts: 220

Threads: 14

Joined: May, 2022

Reputation: 4

  • 0

Replied

@RealNickk
Im converting a FE script I made to a server script and im trying to make Instance.new() work on the server but I cant return the Instance and use it later and Im too lazy to find the Instances manually beacuse yes

https://cdn.discordapp.com/attachments/921902131315875872/973268766895001640/Hello_there.png

 

Whoman#3561 | English & HTML | Learning Lua

RealNickk

am h3x0r

patron Mention

Posts: 3053

Threads: 147

Joined: Feb, 2020

Reputation: 35

  • 0

Replied

@Whoman Oh okay. You need a RemoteFunction to do that, and yes they do support return arguments and accept parameters. Here's an example of arguments (not tested):

local rf = Instance.new("RemoteFunction", game:GetService("ReplicatedStorage"))
rf.OnServerInvoke = function(plr, arg1, arg2)
    print(plr, arg1, arg2) --> player    Hello    World
    return "ret"
end

-- Client code:
local rf = game:GetService("ReplicatedStorage"):WaitForChild("RemoteFunction")
local result = rf:InvokeServer("Hello", "World")
print(result) --> ret

edit: typo

4b5951d5-1b9b-407b-b514-78eb46591564

Whoman

#3561

Mention

Posts: 220

Threads: 14

Joined: May, 2022

Reputation: 4

  • 0

Replied

@RealNickk

Idk man..

https://cdn.discordapp.com/attachments/920343041791905823/984878716175917086/unknown.png

https://cdn.discordapp.com/attachments/921902131315875872/973268766895001640/Hello_there.png

 

Whoman#3561 | English & HTML | Learning Lua

RealNickk

am h3x0r

patron Mention

Posts: 3053

Threads: 147

Joined: Feb, 2020

Reputation: 35

  • 0

Replied

@Whoman .....bruh what

4b5951d5-1b9b-407b-b514-78eb46591564

Whoman

#3561

Mention

Posts: 220

Threads: 14

Joined: May, 2022

Reputation: 4

  • 0

Replied

@RealNickk

nvm I used :Connect() but it still just returns nil..
https://cdn.discordapp.com/attachments/920343041791905823/984880359873327184/unknown.png

https://cdn.discordapp.com/attachments/921902131315875872/973268766895001640/Hello_there.png

 

Whoman#3561 | English & HTML | Learning Lua

RealNickk

am h3x0r

patron Mention

Posts: 3053

Threads: 147

Joined: Feb, 2020

Reputation: 35

  • 0

Replied

@Whoman Are you connecting OnServerInvoke with :Connect? You're not supposed to do that, instead you assign a function to it.

  • 0

Added

@Whoman hmm, unusual

4b5951d5-1b9b-407b-b514-78eb46591564

atari

atari

Mention

Posts: 366

Threads: 24

Joined: Apr, 2022

Reputation: 7

  • 0

Replied

I lost braincells reading this, sorry.

Lua, C# & HTMLLearning C and C++

Exploits I own: Synapse X & Sirhurt

Projects I own/work on: Fume & Ballistic Softworks

Whoman

#3561

Mention

Posts: 220

Threads: 14

Joined: May, 2022

Reputation: 4

  • 0

Replied

@atari

I lost braincells trying to fix this

https://cdn.discordapp.com/attachments/921902131315875872/973268766895001640/Hello_there.png

 

Whoman#3561 | English & HTML | Learning Lua

tar

CoolNickname

Mention

Posts: 107

Threads: 10

Joined: Jul, 2021

Reputation: 1

  • 0

Replied

Are you trying to access to an Instance from server that created on client, you cant do that (This is prob not your problem that you asked but your message is nearly impossible to understand)

https://imgur.com/a/oOomuUo

Whoman

#3561

Mention

Posts: 220

Threads: 14

Joined: May, 2022

Reputation: 4

  • 0

Replied

@tar

read the second reply for better info

https://cdn.discordapp.com/attachments/921902131315875872/973268766895001640/Hello_there.png

 

Whoman#3561 | English & HTML | Learning Lua

Posts: 122

Threads: 6

Joined: Feb, 2022

Reputation: 6

  • 0

Replied

Instructions unclear. I am now mentally deteriorating

Learning how to cheat on roblox

 

Executors I own: Synapse X, Asshurt/Sirhurt, Scriptware


New Reply

Users viewing this thread:


( Members: 0, Guests: 1, Total: 1 )