Categories > Coding > Lua >
how do i send info across 2 players using a script
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
Replied
go with websocket its more funny
Cancel
Post
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!
Replied
As Nick said. I'd rather a WebSocket though.
Cancel
Post
Random quote here...
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)
Cancel
Post
https://media.discordapp.net/attachments/979069297374671018/1078367228593971362/VelvetSiggy.png
hecker dude ngl i hecked 5 ips in 1 second also luaU_loadbiglongjuicythingy(rL);
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post