How do i transfer client to server

im creating a drop (inventory dropping) system but idk how i go to client → server

please help :smiling_face_with_tear:

2 Likes

but i need

only explatations (because i don’t remember)

1 Like

Doesn’t the Creator Hub explain it enough?

no because it connects client --> server and server --> server

What do you even mean by that. There 4 Instances made specifically for what you need, although you can’t use the same one.

no not that the script goes to client -> server and server -> client

example:
client:
image
server:
image

and to say the examples are screenshoots

You want the client script to send something to the server or connect to the server to get for example a value and return it back?

you can do this

  1. make a RemoteFunction

  2. on a clientsided script:

local remote = path.to.remotefunction
-- local script code
remote:InvokeServer("argument 1", "argument 2", "you can add as many as you like") -- this is when you want the server sided code to run
-- more local script code (yes, this part will wait for the server to be done before running)
  1. on server script:
local remote = path.to.remotefunction
remote.OnServerInvoke = function(player, all, the, arguments) -- players argument is there **by default**, you don't need to put in localplayer when doing InvokeServer
    local success, result = xpcall(function()
        -- server sided code here
    end, warn) -- all errors turn to warnings here because xpcall
    return if success and result~=nil then result else true -- uhh i'm too lazy to explain this here
end

is a little true but here the explanation:

the guiButton connects to server to drop an item so not only the client can see it but even all other players