Categories > Coding > Lua >

how do i send info across 2 players using a script

Posts: 2

Threads: 2

Joined: Jan, 2023

Reputation: 0

Posted

i have no other info, just to be able to send like a bool value or something like that from one client to the other using the same script

  • 0

Murz

PixelPenguin

Posts: 240

Threads: 20

Joined: Jul, 2021

Reputation: 29

Replied

go with websocket its more funny

  • 0

 

Ty for rep: Swiney, Byoke, Lion, Locust, Waves, Weeb, Nickk, darkn, Atari, CubeFaces, Lux14, Rice, Delta, Syraxes, Aeon, Jordan, Pluto, and Hiroku!

P.S, I like cats better too!

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

As Nick said. I'd rather a WebSocket though.

  • 0

Random quote here...

Haruka

STD Testing Center

Posts: 58

Threads: 3

Joined: Feb, 2023

Reputation: 5

Replied

you can use Remote Events or Remote Functions, Something like this

-- create a remote event in ServerScriptService
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local RemoteEvent = Instance.new("RemoteEvent")
RemoteEvent.Name = "SendMsgEvent"
RemoteEvent.Parent = ServerScriptService

-- listen for the event on the receiving player
local function onMsgReceived(msg)
    print("Received message:", msg)
end

RemoteEvent.OnServerEvent:Connect(onMsgReceived)

-- send a message from the sending player
local function sendMessage(player, msg)
    RemoteEvent:FireClient(player, msg)
end

local sender = Players.LocalPlayer
local recipient = Players:GetPlayers()[2] -- replace with the desired recipient player

sendMessage(recipient, "Hello from " .. sender.Name)
  • 0

https://media.discordapp.net/attachments/979069297374671018/1078367228593971362/VelvetSiggy.png

 

 

heckerdude

heckerdude

Posts: 129

Threads: 16

Joined: Aug, 2022

Reputation: 6

Replied

@Haruka, Is ChatGPT your best friend?

  • 0

hecker dude ngl i hecked 5 ips in 1 second also luaU_loadbiglongjuicythingy(rL);

Users viewing this thread:

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