Parts duplicating nonstop after check if it's not a certain name?
Title, I'm trying to make a method that replicates my body C0 and C1 positions along with any other parts to the server. if you want me to explain better: When a part is made on the client, it checks if it's not or does not have "ServerReplicatedPart" in it, and if it doesn't, it makes it on the server with active updates of the CFrame and size, name, color, etc... If you need, I can supply any of the necessary scripts for the RemoteFunctions.
01 | local chr = game:GetService( "Players" ).LocalPlayer.Character |
02 | repeat wait() until chr.Torso:FindFirstChild( "Neck" ) ~ = nil |
04 | game:GetService( "RunService" ).RenderStepped:Connect( function () |
05 | game:GetService( "ReplicatedStorage" ).Body:FireServer( { |
06 | RS = chr.Torso [ "Right Shoulder" ] .C 0 , |
07 | LS = chr.Torso [ "Left Shoulder" ] .C 0 , |
08 | RH = chr.Torso [ "Right Hip" ] .C 0 , |
09 | LH = chr.Torso [ "Left Hip" ] .C 0 , |
10 | N = chr.Torso [ "Neck" ] .C 0 , |
11 | R = chr.HumanoidRootPart [ "RootJoint" ] .C 0 |
14 | RS = chr.Torso [ "Right Shoulder" ] .C 1 , |
15 | LS = chr.Torso [ "Left Shoulder" ] .C 1 , |
16 | RH = chr.Torso [ "Right Hip" ] .C 1 , |
17 | LH = chr.Torso [ "Left Hip" ] .C 1 , |
18 | N = chr.Torso [ "Neck" ] .C 1 , |
19 | R = chr.HumanoidRootPart [ "RootJoint" ] .C 1 |
24 | script.Parent.DescendantAdded:Connect( function (p) |
25 | if p:FindFirstChild( "ServerReplicatedPart" ) = = nil and p.Name ~ = "ServerReplicatedPart" then |
26 | p 2 = game:GetService( "ReplicatedStorage" ).Create:InvokeServer(p.ClassName,p.Parent:GetFullName()) |
28 | p.Changed:Connect( function (prop) |
29 | game:GetService( "ReplicatedStorage" ).Change:InvokeServer(p 2 ,prop,p [ prop ] ) |
31 | if p 2 :IsA( "BasePart" ) then |
33 | if p 2 :IsA( "BasePart" ) then |
34 | game:GetService( "ReplicatedStorage" ).Change:InvokeServer(p 2 , "CFrame" ,p.CFrame) |
40 | script.Parent.DescendantRemoving:Connect( function (p) |
41 | if p:FindFirstChild( "ServerReplicatedPart" ) = = nil and p.Name ~ = "ServerReplicatedPart" then |
42 | game:GetService( "ReplicatedStorage" ).Removee:InvokeServer(p:GetFullName()) |