How can other people see what your building?

I have this placement system working and all, but when i go into the server mode, the blocks don’t show up. How can i fix this?

you can use remote events to send over info to the server so everyone can see what you placed
if you need more help on remote events i can give u more info on them. :slight_smile:

i dont know how to use remote events or remote functions

When you go to actually create/place the block, this is something that the server needs to do so all clients (players) can see it.

To accomplish that, we use RemoteEvents, like Lp suggested.

Essentially this is how you would set a server event up on a RemoteEvent object, from a server-sided script obviously:

local remote = workspace.some_remote --//path to some remote
remote.OnServerEvent:Connect(function(player, blockData) --//'player' argument is automatically passed in, we'll send in blockData which could be a table containing info for the block we're placing
--//Do stuff with the table passed in. Could include fields such as the type of block we're placing, and more importantly the CFrame for it. then all we have to do is have the server create a block based on the info passed in.
end)

Hope this helps. :slight_smile:

so i should put this script in the server script service? (the function that places the block)

local function Placement()
 if IsPlacing and CanPlace and Mouse.Target.Name == "Terrain" then
  local PlacedModel = Model:Clone()
  local modelPosition = PlacedModel.GSOoneblock.Position
  local event = game:GetService("ReplicatedStorage"):WaitForChild("PlacementEvent")
  PlacedModel.GSOoneblock.CanCollide = true
  PlacedModel.GSOoneblock.Anchored = false
  game.ReplicatedStorage.Values.GSOoneblock.Value = game.ReplicatedStorage.Values.GSOoneblock.Value -1
  event:FireServer(PlacedModel, modelPosition)
  PlacedModel.GSOoneblock.SelectionBox.Visible = false
  PlacedModel.Parent = workspace.PlacedObjects
 end
end

sorry if this is a stupid question

if your putting that whole script in then no clients can only do FireServer() to the remote event and server scripts can do FireClient or FireAllClients

for the client script once u click on the part you would send over the position of the part and the part its self , game.ReplicatedStorage.REMOTENAMEHERE:FireServer(Part,position)
and on the server you would do game.ReplicatedStorage.REMOTENAMEHERE.OnServerEvent:Connect(function(plr,part,position)
part.position = position
end)
or you can do cframe with mouse.hit

sorry i forgot this my bad on the OnServerEvent part add plr before the part and position

im doing cframe with mouse.hit in the client script, should i do it in the server script?

It is not sending the part for some reason.
Capture_2020_03_03_17_52_37_615
Capture_2020_03_03_17_37_51_820
Capture_2020_03_03_17_52_46_511


You can’t send instances to the server using remote events. Try storing your data into a table.

what i am trying to send is a model/part. and not an instance? do you mean the weld?

I mean the model itself. It cannot be sent.

You can send references to instances over just fine. The issue is probably that the model is being created locally, thus the server can’t see it

1 Like