How do you send part to other servers?

Hello!
I’m working on a game, where when you place the part, it becomes visible to every other server. The problem is when I place it (so it fires the remote event down below), it’s not sending it to the other servers. Here’s the part of my code.

game:GetService("ReplicatedStorage").PartPlaced.OnServerEvent:Connect(function(plr, cf, color, canPlace)
	if canPlace then
	plr:WaitForChild("Timer").Value = os.time() + 3600
	game:GetService("MessagingService"):SubscribeAsync("placed", function(data)
		local part = Instance.new("Part", workspace)	
		part.Name = plr.Name.."'s Part"
		part.Transparency = 0
		part.Color = color
		part.CanCollide = true
		part.Anchored = true
		part.CFrame = cf
		end)	
		
		game:GetService("MessagingService"):PublishAsync("placed")
	end
end)

Any help is appreciated!

A couple things:

First, firing PublishAsync every time a block is placed will quickly cause you to run into ratelimiting. The ratelimit is (10 + 20 * number of servers) per minute for receiving messages from a topic per the docs. MessagingService | Documentation - Roblox Creator Hub

Second, you should serialize the data describing the part, then send that through to the receiver where the part can be re-constructed using that data. I’m not sure if you can send instances through MessagingService but either way this will make your networking more efficient.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.