So when I make a part inside a local script it doesn't show the other player the part. How do I fix this?
You can use Remotes! :D
Remotes are RemoteEvents
and RemoteFunctions
. These provide client to server communication and are normally used for FilteringEnabled.
So, you need to use the FireServer
function on a RemoteEvent in ReplicatedStorage. This will send a request to the RemoteEvent and if there are any OnServerEvent
events listening, then they will fire upon recieving the request.
--Your RemoteEvent local re = game.ReplicatedStorage.CreatePart --Use the FireServer function on it re:FireServer()
Note: This should be a localscript^
Now, you can have a script inside the remote event that creates the part. You need to use the OnServerEvent
event to 'listen' for the FireServer
request.
script.Parent.OnServerEvent:connect(function() --Create the part local p = Instance.new("Part",workspace) p.Size = Vector3.new(5,5,5); p.Anchored = true; p.CFrame = CFrame.new(0,10,0) end)
Note: This should be a server script^
What would be wrong with this?
script.Parent.OnServerEvent:connect(function(Player,player,char,scan) for _,scan in pairs (scan) do if scan.ClassName == "Hat" or scan.Name == "Pants" or scan.Name == "Shirt" then local clone = scan:Clone() clone.Parent = char if scan.ClassName == "Hat" then local weld = Instance.new("Weld",char.Head) weld.Part0 = char.Head weld.Part1 = clone.Handle weld.C0 = CFrame.new(0,0.5,0) weld.C1 = clone.AttachmentPoint end end if scan:FindFirstChild("face") then local clone = scan.face:Clone() clone.Parent = char.Head end end end)