Frame sending from client to the server not working [solved]

So, i am making a painting gui in roblox and i want to send the painting frame to the server from the client so everybody can see, thus the problem is that the frame only shows the descendants to the client player, now i add a waiting time, it deletes, then comes back with the painting pieces only for me (if i was the one painting), but it doesn’t show for the other players and same problem with others

client:

function sendDataToServer(data)
	game.ReplicatedStorage.ReturnPainting:InvokeServer(data)
end

script.Parent.Parent.Exit.MouseButton1Up:Connect(function()
	sendDataToServer(canvas)
end)

(test) Server:

game.ReplicatedStorage.ReturnPainting.OnServerInvoke = function(Player, data)
	local paintingFrame = data-- Create the painting frame based on the received data
	paintingFrame.Parent = game.Workspace
end

but through server there is nothing

Any help?

Instances made on the client are not replicated on the server.


(Taken from the link above.)

Generally, as a rule, I wouldn’t pass an object through remotes, instead, I would serialize the data and send it to the server. Take note that the data should be validated to prevent hacks from taking place on the server.

The part is already their and the frame is going through its just that other players can’t see the descandents only the painter can

Like I said:

Your code for painting is client-sided, hence, other players will not see what the painter paints on the canvas. You cannot simply send the canvas instance to the server for other players to see.

Then how can i send the frame through to the server for others to see its only thing left in my model

You might have to redesign your code responsible for painting on the canvas.

Whenever the player paints on the canvas, you can save the:

  1. Position of the paint
  2. Color of the paint

Put all of this data into a table and send this table to the server through a remote. On the server script, create code to create paint on the canvas based on the data received from the player.

like put them in datastore on just a normal table?

A normal table is fine. You should only use the datastore when you want to save the canvas data even after the player leaves the game.

so the table design should be like pieces = {[“colorpiece”] = {Size = Udim2, Position = Udim2, Color = Color3}}

Your idea is correct, but it can be simplified to this:

local CanvasData = {
	{X,Y,Color},
	{X,Y,Color},
	--and so on
}

Then when you send this table to server, you can recreate the canvas with code like this:

for _, Piece in pairs(data) do
	local NewPiece = Instance.new("Frame")
	NewPiece.Parent = Canvas
	NewPiece.Position = UDim2.new(0, Piece[1],0, Piece[2]) --not sure if this is right, I'm just working from what I remember
	NewPiece.Color3 = Piece[3]
end
1 Like

it keeps saying exceding limit 500001 from sending the data

I’m not sure what that means, but I’m guessing you’re sending data too frequently. Remotes have a built-in cooldown to prevent spamming so you should try slowing down the refresh rate of the canvas.