How to transfer info from local script to a script

Hello developers, can you explain how to transfer info from local script to a script,
I already saw some pages about event and more but I’m are not english so It’s hard for me to understand it.
There no tutorials pages or video on my language I found.
Help please

1 Like

What information do you want to transfer?

1 Like

Like I need a mouse pos in script to use applyimpulse thing, but how to get that vector3 position of mouse in script from local script

why you reply and close forum?

Hello Tim! I’ll try to help you about this situation.

First of all you can do what you’re trying to do by using RemoteEvents! Simply create a RemoteEvent and connect an OnServerEvent connection to this remote event and pass the information you’re trying to share as a parameter!

Here’s an example code you can try out:

-- Server Script
local remote = Instance.new("RemoteEvent")
remote.Name = "PassInfo"
remote.Parent = game.ReplicatedStorage

remote.OnServerEvent:Connect(function(player, info)
    print(info)
end)

And on client you should do:

local remote = game.ReplicatedStorage:WaitForChild("PassInfo")

remote:FireServer("Hello there!!!")

this would basically print “Hello there!!!” on server. It’s that simple and i hope you understand :slight_smile:

1 Like

Thank you, I’ll try that out right now.

Can you explain the difference of BindableEvent and RemoteEvent please?

BindableEvents are used to communicate same type of scripts like client-client or server-server

meanwhile RemoteEvents are used to communicate opposite type of scripts like client-server or server-client

2 Likes

I asked it so more people are likely to be able to help you.

Apologies that I didn’t see your reply though.