Spawn part on server, not locally

Hey! I’m making a tool that’s spawning parts when clicked. I’m still learning scripting, so I’m not an expert in events and it’s probably obvious how to make that. Anyway, If a player activates the tool, I want the part to be visible to everyone and not locally. (I searched the internet too). The tool works locally, but it needs to be on a server. Thanks for all the answers!
image image

1 Like

You need to create a RemoteEvent to spawn the part Server Sided,

Create a remoteEvent with the part creation code, adding the player as the first parameter as per usual, and another parameter for the CFrame,

And in your acitvated event, make it fire the event, passing in Mouse.Hit

1 Like

First make a remote event and put it in replicated storage

Second add a script in server script storage and add these line:

   Local event = game.ReplicatedStorage. ----your remote event

event.OnServerEvent:connect(function(plr, position  )

  Local part = instance.new("Part", workspace)
 Part.Position= position
End)

In the tool add these line of script in your mousebutton1click

Local event = ----your event

event:FireServer() ---- here you send your position for the part you want to be
3 Likes