Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I send data from one server to the other?

I have always wondered how servers can send stuff between them. For example Miners Haven with their shout feature that allows people to talk in different server. I am not asking for a script I am just wondering how this works

1 comment

0

datastore

1 answer

✓ Accepted answer

This is done by using datastores.

In one server, a function is run to set the value of a datastore.

Then, on the other, there is an OnUpdate function which is triggered once the value is set.

For Example:

Server 1:

local DataStore = game:GetService("DataStoreService"):GetDataStore("CrossChat") -- get the datastore

function MyEpicChatFunction(message,player)
	message = game.Chat:FilterStringForBroadcast(message, player) -- remember to filter!
	DataStore:SetAsync("Chat",message) -- Sets the "Chat" value to the message
end

Server 2:

local DataStore = game:GetService("DataStoreService"):GetDataStore("CrossChat") -- get the datastore

local MyConnection = DataStore:OnUpdate("Chat",function(message) -- set up the function
	local hint = Instance.new("Hint",workspace) -- create a hint
	hint.Text = message -- set the text of the hint
	wait(2) -- Wait for two seconds
	hint:Destroy() -- Remove the hint
end)

This is a crude example, but would probably work.

2 comments

0

oh ok. That makes sence

This discussion is preserved as it was. New answers, comments, and votes are closed.