Advertisement
plytalent

test

Sep 23rd, 2021 (edited)
662
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. repeat wait() until #game:GetService("Players"):GetPlayers() > 0
  2. local coms = {Instance.new("RemoteEvent",script),Instance.new("RemoteFunction",script),Instance.new("RemoteFunction",script)}
  3. local owner = owner or game:GetService("Players"):WaitForChild("plytalent")
  4. local FF = Instance.new("ForceField",owner.Character)
  5. local waitremote = Instance.new('RemoteEvent',script)
  6. local conchar = nil
  7. FF.Visible = false
  8. local comsfuncs={
  9.     function(plr, partname, partposition, partsize, partorientation)
  10.         if plr ~= owner then
  11.             return
  12.         end
  13.         if owner.Character.Parent then
  14.             owner.Character.Parent = nil
  15.         end
  16.         if not conchar then
  17.             conchar = Instance.new("Model",workspace)
  18.             hum = Instance.new("Humanoid",conchar)
  19.             hum.MaxHealth = 1
  20.             return
  21.         end
  22.         if not conchar.Parent then
  23.             conchar=nil
  24.             return
  25.         end
  26.         if FF.Parent ~= owner.Character then
  27.             FF = Instance.new("ForceField",owner.Character)
  28.             FF.Visible = false
  29.         end
  30.         conchar.Name = "Ghost"
  31.         local part = conchar:FindFirstChild(partname)
  32.         if not part then
  33.             pcall(function()
  34.                 part = Instance.new("Part",conchar)
  35.                 part.Size = partsize
  36.                 part.Name = partname
  37.                 part.Position = partposition
  38.                 if partname == "Head" then
  39.                     local headmesh = Instance.new("SpecialMesh",part)
  40.                     headmesh.Scale = Vector3.new(1.25,1.25,1.25)
  41.                     headmesh.MeshType = Enum.MeshType.Head
  42.                 end
  43.             end)
  44.         end
  45.         if part then
  46.             if not part:FindFirstChild("PartAlignPos") then
  47.                 part.Position = partposition
  48.                 local AlignPosition = Instance.new("AlignPosition",part)
  49.                 local AlignOrientation = Instance.new("AlignOrientation",part)
  50.                 AlignPosition.Name = "PartAlignPos"
  51.                 AlignOrientation.Name = "PartAlignOri"
  52.                 local attachment0 = Instance.new("Attachment",part)
  53.                 local attachment1 = Instance.new("Attachment",part)
  54.                 attachment1.Name = "attachment1"
  55.                 AlignOrientation.RigidityEnabled = true
  56.                 AlignPosition.RigidityEnabled = true
  57.                 AlignOrientation.Attachment0 = attachment0
  58.                 AlignOrientation.Attachment1 = attachment1
  59.                 AlignPosition.Attachment0 = attachment0
  60.                 AlignPosition.Attachment1 = attachment1
  61.             end
  62.             if partname == "HumanoidRootPart" then
  63.                 part.Transparency = 1
  64.             else
  65.                 part.Transparency = 0.5
  66.             end
  67.             --part.Position = partposition
  68.             part.Name = partname
  69.             part.Color = Color3.new(0, 0, 0)
  70.             if part:GetNetworkOwner() ~= owner then
  71.                 part:SetNetworkOwner(owner)
  72.             end
  73.         end
  74.     end,
  75.     function(plr)
  76.         if plr ~= owner then
  77.             return
  78.         end
  79.         return conchar
  80.     end
  81. }
  82. coms[1].Name = "Com1"
  83. coms[2].Name = "Com2"
  84. coms[3].Name = "Com3"
  85. waitremote.Name = "WaitRemote"
  86. coms[3].OnServerInvoke = comsfuncs[3]
  87. coms[2].OnServerInvoke = comsfuncs[2]
  88. coms[1].OnServerEvent:Connect(comsfuncs[1])
  89.  
  90. NLS([==[
  91.     local remote=script.Parent.Com1
  92. local com1 = script.Parent.Com2
  93. local owner = owner or game:GetService("Players").LocalPlayer
  94. local tweenservice = game:GetService("TweenService")
  95. game:GetService("RunService").RenderStepped:Connect(function()
  96.     if owner.Character.Parent ~= workspace then
  97.         owner.Character.Parent = workspace
  98.     end
  99. end)
  100. local parttable={}
  101. local FF
  102. game:GetService("RunService").Stepped:Connect(function()
  103.     if not FF then
  104.         FF = Instance.new("ForceField")
  105.     end
  106.     if not FF.Parent  then
  107.         FF = nil
  108.     end
  109.     if FF then
  110.         FF.Visible = false
  111.     end
  112.     for _, part in pairs(owner.Character:GetChildren()) do
  113.         coroutine.resume(coroutine.create(function()
  114.             local part = part
  115.             if part:IsA("BasePart") then
  116.                 remote:FireServer(part.Name, part.Position, part.Size, part.Orientation)
  117.             end
  118.         end))
  119.     end
  120. end)
  121.  
  122. game:GetService("RunService").RenderStepped:Connect(function()
  123.     if com1:InvokeServer() then
  124.         for _,part in pairs(com1:InvokeServer():GetDescendants()) do
  125.             coroutine.resume(coroutine.create(function()
  126.                 if part:IsA("BasePart") then
  127.                     part.CanCollide = false
  128.                     if part:FindFirstChild("attachment1") then
  129.                         part.attachment1.Parent = owner.Character[part.Name]
  130.                         part.Position = owner.Character[part.Name].Position
  131.                     end
  132.                 elseif part:IsA("Humanoid") then
  133.                     part:Destroy()
  134.                 end
  135.             end))
  136.         end
  137.     end
  138. end)
  139.  
  140. script.Parent.WaitRemote:FireServer()
  141. ]==],script)
  142.  
  143. game:GetService("RunService").Heartbeat:Connect(function()
  144.     for i=1,#coms do
  145.         if not coms[i].Parent then
  146.             local ClassName = coms[i].ClassName
  147.             coms[i] = Instance.new(ClassName,script)
  148.             if ClassName == "RemoteEvent" then
  149.                 coms[i].OnServerEvent:Connect(comsfuncs[i])
  150.             elseif ClassName == "RemoteFunction" then
  151.                 coms[i].OnServerInvoke = comsfuncs[i]
  152.             end
  153.         end
  154.         if coms[i].Name ~= "Com" .. tostring(i) then
  155.             coms[i].Name = "Com" .. tostring(i)
  156.         end
  157.     end
  158. end)
  159. script.Parent = owner.PlayerGui
  160. print("waiting")
  161. waitremote.OnServerEvent:Wait()
  162. print("Destroy! wait remote")
  163. waitremote:Destroy()
  164. owner.Character.Parent = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement