Advertisement
Rufus14

GHOST SCRIPT IN 2019?!?!?!?

Jul 11th, 2019
3,395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.62 KB | None | 0 0
  1. --By Rufus14
  2. --owner = game.Players:FindFirstChild(script.Parent.Name)
  3. NLS([[
  4. localplr = game:GetService("Players").LocalPlayer
  5. gui = localplr:findFirstChildOfClass("PlayerGui")
  6. print("waiting for gui and remote")
  7. local ghostgui = gui:WaitForChild("Ghost_Gui")
  8. local viewport = ghostgui:WaitForChild("Ghost")
  9. local remote = ghostgui:WaitForChild("GhostRemote")
  10. localplr.Character.Archivable = true
  11. local clone = localplr.Character:Clone()
  12. clone.Name = "(Your last position.)"
  13. for i,v in pairs(clone:GetChildren()) do
  14.     if v.ClassName == "Script" or v.ClassName == "LocalScript" then
  15.         v.Disabled = true
  16.     end
  17.     if v:findFirstChildOfClass("Sound") then
  18.         v:findFirstChildOfClass("Sound"):destroy()
  19.     end
  20.     if v.ClassName == "Sound" then
  21.         v:destroy()
  22.     end
  23.     if v.ClassName == "MeshPart" or v.ClassName == "Part" then
  24.         v.Anchored = true
  25.     end
  26.     if v:findFirstChildOfClass("Decal") then
  27.         v:findFirstChildOfClass("Decal").Transparency = 0
  28.     end
  29.     if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
  30.         v.Transparency = 0
  31.     end
  32.     if v.Name == "HumanoidRootPart" then
  33.         v.Transparency = 1
  34.     end
  35.     if v.ClassName == "Accessory" then
  36.         if v:findFirstChild("Handle") then
  37.             if v:findFirstChild("Handle").ClassName == "Part" then
  38.                 v:findFirstChild("Handle").Transparency = 0
  39.             end
  40.         end
  41.     end
  42. end
  43. clone.Parent = viewport
  44. viewport.CurrentCamera = workspace.CurrentCamera
  45. localplr.Character.Parent = workspace
  46. print("ghosted")
  47. print("showed last position")
  48. function uncollide()
  49.     if localplr.Character.Torso.Transparency >= 0.8 then
  50.         for i,v in pairs(localplr.Character:GetChildren()) do
  51.             if v.Name == "Head" or v.Name == "Torso" then
  52.                 v.CanCollide = false
  53.             end
  54.         end
  55.     end
  56. end
  57. game:GetService("RunService").Stepped:connect(uncollide)
  58. function ded()
  59.     ghostgui:destroy()
  60.     remote:FireServer("a", "a", "respawn")
  61. end
  62. localplr.Character:findFirstChildOfClass("Humanoid").Died:connect(ded)
  63. function checkwhatadded(wat)
  64.     if wat.Name == "EnterTheShadowRealm" then
  65.         wat:destroy()
  66.         localplr.Character.Parent = workspace
  67.         if viewport:findFirstChild("(Your last position.)") then
  68.             viewport:findFirstChild("(Your last position.)"):destroy()
  69.         end
  70.         localplr.Character.Archivable = true
  71.         local clone = localplr.Character:Clone()
  72.         clone.Name = "(Your last position.)"
  73.         for i,v in pairs(clone:GetChildren()) do
  74.             if v.ClassName == "Script" or v.ClassName == "LocalScript" then
  75.                 v.Disabled = true
  76.             end
  77.             if v:findFirstChildOfClass("Sound") then
  78.                 v:findFirstChildOfClass("Sound"):destroy()
  79.             end
  80.             if v.ClassName == "Sound" then
  81.                 v:destroy()
  82.             end
  83.             if v.ClassName == "MeshPart" or v.ClassName == "Part" then
  84.                 v.Anchored = true
  85.             end
  86.             if v:findFirstChildOfClass("Decal") then
  87.                 v:findFirstChildOfClass("Decal").Transparency = 0
  88.             end
  89.             if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
  90.                 v.Transparency = 0
  91.             end
  92.             if v.Name == "HumanoidRootPart" then
  93.                 v.Transparency = 1
  94.             end
  95.             if v.ClassName == "Accessory" then
  96.                 if v:findFirstChild("Handle") then
  97.                     if v:findFirstChild("Handle").ClassName == "Part" then
  98.                         v:findFirstChild("Handle").Transparency = 0
  99.                     end
  100.                 end
  101.             end
  102.         end
  103.         clone.Parent = viewport
  104.     end
  105. end
  106. localplr.Character.DescendantAdded:connect(checkwhatadded)
  107. while game:GetService("RunService").RenderStepped:wait() do
  108.     for i,v in pairs(localplr.Character:GetChildren()) do
  109.         if v.ClassName == "Part" or v.ClassName == "MeshPart" then
  110.             remote:FireServer(v, v.CFrame, "position")
  111.         end
  112.     end
  113. end
  114. ]], owner.Character)
  115. print("making gui")
  116. local screengui = Instance.new("ScreenGui", owner:findFirstChildOfClass("PlayerGui"))
  117. local remote = Instance.new("RemoteEvent", screengui)
  118. remote.Name = "GhostRemote"
  119. local viewport = Instance.new("ViewportFrame", screengui)
  120. viewport.BackgroundTransparency = 1
  121. viewport.ImageTransparency = 0.7
  122. viewport.Name = "Ghost"
  123. viewport.Size = UDim2.new(1,0,1,36)
  124. viewport.Position = viewport.Position + UDim2.new(0,0,0,-36)
  125. screengui.ResetOnSpawn = true
  126. -- Farewell Infortality.
  127. -- Version: 2.82
  128. -- Instances:
  129. local ghostbutton = Instance.new("TextButton")
  130. local visible = Instance.new("TextButton")
  131. local human = Instance.new("TextButton")
  132. local whattodo = Instance.new("TextLabel")
  133. local credits = Instance.new("TextLabel")
  134. --Properties:
  135.  
  136. ghostbutton.Name = "ghostbutton"
  137. ghostbutton.Parent = screengui
  138. ghostbutton.BackgroundColor3 = Color3.new(1, 1, 1)
  139. ghostbutton.Position = UDim2.new(0.618315041, 0, 0.0375169665, 0)
  140. ghostbutton.Size = UDim2.new(0, 235, 0, 32)
  141. ghostbutton.Font = Enum.Font.GothamSemibold
  142. ghostbutton.Text = "Ghost: On"
  143. ghostbutton.TextColor3 = Color3.new(0, 0, 0)
  144. ghostbutton.TextSize = 30
  145. ghostbutton.TextWrapped = true
  146.  
  147. visible.Name = "visible"
  148. visible.Parent = screengui
  149. visible.BackgroundColor3 = Color3.new(1, 1, 1)
  150. visible.Position = UDim2.new(0.446153849, 0, 0.0375169665, 0)
  151. visible.Size = UDim2.new(0, 235, 0, 32)
  152. visible.Font = Enum.Font.GothamSemibold
  153. visible.Text = "Visible: On"
  154. visible.TextColor3 = Color3.new(0, 0, 0)
  155. visible.TextSize = 30
  156. visible.TextWrapped = true
  157.  
  158. human.Name = "humanbutton"
  159. human.Parent = screengui
  160. human.BackgroundColor3 = Color3.new(1, 1, 1)
  161. human.Position = UDim2.new(0.447, 0, 0, 64)
  162. human.Size = UDim2.new(0, 470, 0, 32)
  163. human.Font = Enum.Font.GothamSemibold
  164. human.Text = "Body Type: Ghost"
  165. human.TextColor3 = Color3.new(0, 0, 0)
  166. human.TextSize = 30
  167. human.TextWrapped = true
  168.  
  169. whattodo.Name = "whattodo"
  170. whattodo.Parent = screengui
  171. whattodo.BackgroundTransparency = 1
  172. whattodo.TextTransparency = 1
  173. whattodo.Position = UDim2.new(0.447, 0, 0, 92)
  174. whattodo.Size = UDim2.new(0, 470, 0, 32)
  175. whattodo.Font = Enum.Font.GothamSemibold
  176. whattodo.Text = "If you are getting pushed, ghost yourself again."
  177. whattodo.TextColor3 = Color3.new(0, 0, 0)
  178. whattodo.TextScaled = true
  179. whattodo.TextWrapped = true
  180.  
  181. credits.Name = "credits"
  182. credits.Parent = screengui
  183. credits.BackgroundTransparency = 1
  184. credits.Position = UDim2.new(0.447, 0, 0, 125)
  185. credits.Size = UDim2.new(0, 470, 0, 32)
  186. credits.Font = Enum.Font.GothamSemibold
  187. credits.TextColor3 = Color3.new(0, 0, 0)
  188. credits.TextScaled = true
  189. credits.TextWrapped = true
  190. credits.Text = "By Rufus14"
  191.  
  192. owner.Character.Parent = viewport
  193. screengui.Name = "Ghost_Gui"
  194. isghost = true
  195. isvisible = true
  196. humanbody = false
  197. for i,v in pairs(owner.Character:GetChildren()) do
  198.     if v:findFirstChildOfClass("Decal") then
  199.         v:findFirstChildOfClass("Decal").Transparency = 1
  200.     end
  201.     if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
  202.         v.Transparency = 0.9
  203.     end
  204.     if v.Name == "HumanoidRootPart" then
  205.         v.Transparency = 1
  206.     end
  207.     if v.ClassName == "Accessory" then
  208.         if v:findFirstChild("Handle") then
  209.             if v:findFirstChild("Handle").ClassName == "Part" then
  210.                 v:findFirstChild("Handle").Transparency = 1
  211.             end
  212.         end
  213.     end
  214. end
  215. function clickedghost()
  216.     if isghost then
  217.         isghost = false
  218.         ghostbutton.Text = "Ghost: Off"
  219.         for i,v in pairs(owner.Character:GetChildren()) do
  220.             if v:findFirstChildOfClass("Decal") then
  221.                 v:findFirstChildOfClass("Decal").Transparency = 0
  222.             end
  223.             if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
  224.                 v.Transparency = 0
  225.             end
  226.             if v.Name == "HumanoidRootPart" then
  227.                 v.Transparency = 1
  228.             end
  229.             if v.ClassName == "Accessory" then
  230.                 if v:findFirstChild("Handle") then
  231.                     if v:findFirstChild("Handle").ClassName == "Part" then
  232.                         v:findFirstChild("Handle").Transparency = 0
  233.                     end
  234.                 end
  235.             end
  236.         end
  237.         owner.Character.Parent = workspace
  238.         for i,v in pairs(owner.Character:GetChildren()) do
  239.             if v.ClassName == "Accessory" then
  240.                 local hingee = v.Handle:findFirstChildOfClass("HingeConstraint")
  241.                 if hingee then
  242.                     hingee:destroy()
  243.                 end
  244.             end
  245.         end
  246.         for i,v in pairs(owner.Character:GetChildren()) do
  247.             if v.ClassName == "Accessory" then
  248.                 v.Handle.CanCollide = false
  249.                 local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
  250.                 if attachment1 then
  251.                     for q,w in pairs(owner.Character:GetChildren()) do
  252.                         if w.ClassName == "Part" or w.ClassName == "MeshPart" then
  253.                             local attachment2 = w:findFirstChild(attachment1.Name)
  254.                             if attachment2 then
  255.                                 local hinge = Instance.new("HingeConstraint", v.Handle)
  256.                                 hinge.Attachment0 = attachment1
  257.                                 hinge.Attachment1 = attachment2
  258.                                 hinge.LimitsEnabled = true
  259.                                 hinge.LowerAngle = 0
  260.                                 hinge.UpperAngle = 0
  261.                                 hinge.Name = "hatholder"
  262.                             end
  263.                         end
  264.                     end
  265.                 end
  266.             end
  267.         end
  268.     else
  269.         isghost = true
  270.         ghostbutton.Text = "Ghost: On"
  271.         owner.Character.Parent = viewport
  272.         local bool = Instance.new("BoolValue", owner.Character)
  273.         bool.Name = "EnterTheShadowRealm"
  274.         game.Debris:AddItem(bool, 0.1)
  275.         for i,v in pairs(owner.Character:GetChildren()) do
  276.             if v:findFirstChildOfClass("Decal") then
  277.                 v:findFirstChildOfClass("Decal").Transparency = 1
  278.             end
  279.             if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
  280.                 v.Transparency = 0.9
  281.             end
  282.             if v.Name == "HumanoidRootPart" then
  283.                 v.Transparency = 1
  284.             end
  285.             if v.ClassName == "Accessory" then
  286.                 if v:findFirstChild("Handle") then
  287.                     if v:findFirstChild("Handle").ClassName == "Part" then
  288.                         v:findFirstChild("Handle").Transparency = 1
  289.                     end
  290.                 end
  291.             end
  292.         end
  293.     end
  294. end
  295. function clickedhuman()
  296.     if humanbody then
  297.         humanbody = false
  298.         human.Text = "Body Type: Ghost"
  299.         whattodo.TextTransparency = 1
  300.         if isghost then
  301.             human.Active = false
  302.             isghost = false
  303.             wait(0.5)
  304.             local faaaace = owner.Character.Head:findFirstChildOfClass("Decal")
  305.             if faaaace then
  306.                 faaaace.Transparency = 1
  307.             end
  308.             human.Active = true
  309.             isghost = true
  310.         end
  311.     else
  312.         humanbody = true
  313.         human.Text = "Body Type: Human"
  314.         whattodo.TextTransparency = 0
  315.         if isghost then
  316.             human.Active = false
  317.             isghost = false
  318.             wait(0.5)
  319.             local faaaace = owner.Character.Head:findFirstChildOfClass("Decal")
  320.             if faaaace then
  321.                 faaaace.Transparency = 1
  322.             end
  323.             human.Active = true
  324.             isghost = true
  325.         end
  326.     end
  327. end
  328. function clickedvisible()
  329.     if isvisible then
  330.         isvisible = false
  331.         visible.Text = "Visible: Off"
  332.     else
  333.         isvisible = true
  334.         visible.Text = "Visible: On"
  335.     end
  336. end
  337. human.MouseButton1Click:connect(clickedhuman)
  338. visible.MouseButton1Click:connect(clickedvisible)
  339. ghostbutton.MouseButton1Click:connect(clickedghost)
  340. local physics = game:GetService("PhysicsService")
  341. collisiongroup = "ghost"
  342. function event(plr, limb, cframe, what)
  343.     if plr == owner then
  344.         if what == "position" then
  345.             if humanbody then
  346.                 physics:RemoveCollisionGroup(collisiongroup)
  347.                 local collisiongroup = "ghost"
  348.                 physics:CreateCollisionGroup(collisiongroup)
  349.                 physics:CollisionGroupSetCollidable(collisiongroup, collisiongroup, false)
  350.             end
  351.             if not isvisible or not isghost then
  352.                 if workspace:findFirstChild(owner.Name.." (Ghost)") then
  353.                     workspace:findFirstChild(owner.Name.." (Ghost)"):destroy()
  354.                 end
  355.                 return
  356.             end
  357.             if not workspace:findFirstChild(owner.Name.." (Ghost)") then
  358.                 Instance.new("Model", workspace).Name = owner.Name.." (Ghost)"
  359.             end
  360.             if humanbody then
  361.                 if not workspace:findFirstChild(owner.Name.." (Ghost)"):findFirstChildOfClass("Humanoid") then
  362.                     Instance.new("Humanoid", workspace:findFirstChild(owner.Name.." (Ghost)")).Name = "Ghost"
  363.                 end
  364.             end
  365.             if not workspace[owner.Name.." (Ghost)"]:findFirstChild(limb.Name) then
  366.                 local part = Instance.new("Part", workspace[owner.Name.." (Ghost)"])
  367.                 part.Size = limb.Size
  368.                 if humanbody then
  369.                     part.Material = limb.Material
  370.                     part.Transparency = 0
  371.                     part.BrickColor = limb.BrickColor
  372.                 else
  373.                     if owner.Name == "Rufus14" then
  374.                         part.BrickColor = limb.BrickColor
  375.                     else
  376.                         part.BrickColor = BrickColor.new("Institutional white")
  377.                     end
  378.                     part.Material = "ForceField"
  379.                     part.Transparency = 0.6
  380.                 end
  381.                 part.Anchored = true
  382.                 part.Name = limb.Name
  383.                 part.CanCollide = false
  384.                 part.CFrame = cframe
  385.                 if part.Name == "HumanoidRootPart" then
  386.                     part.Transparency = 1
  387.                 end
  388.                 if part.Name == "Head" then
  389.                     if humanbody then
  390.                         local meeeesh = owner.Character.Head:findFirstChildOfClass("SpecialMesh")
  391.                         local faaaace = owner.Character.Head:findFirstChildOfClass("Decal")
  392.                         if faaaace then
  393.                             faaaace.Archivable = true
  394.                             faaaace.Transparency = 0
  395.                             local cloneme = faaaace:Clone()
  396.                             cloneme.Parent = part
  397.                         end
  398.                         if meeeesh then
  399.                             meeeesh.Archivable = true
  400.                             local cloneme = meeeesh:Clone()
  401.                             cloneme.Parent = part
  402.                         end
  403.                     end
  404.                     if not part:findFirstChild("Text") and not humanbody then
  405.                         -- Farewell Infortality.
  406.                         -- Version: 2.82
  407.                         -- Instances:
  408.                         local Text = Instance.new("BillboardGui")
  409.                         local Name = Instance.new("TextLabel")
  410.                         --Properties:
  411.                         Text.Name = "Text"
  412.                         Text.Parent = part
  413.                         Text.Size = UDim2.new(2, 0, 2, 0)
  414.                         Text.StudsOffset = Vector3.new(-4, 2, 0)
  415.                        
  416.                         Name.Name = "Name"
  417.                         Name.Parent = Text
  418.                         Name.BackgroundTransparency = 1
  419.                         Name.Size = UDim2.new(5, 0, 1, 0)
  420.                         Name.Font = Enum.Font.GothamSemibold
  421.                         Name.Text = owner.Name.." (Ghost)"
  422.                         Name.TextColor3 = Color3.new(1, 1, 1)
  423.                         Name.TextScaled = true
  424.                         Name.TextSize = 3
  425.                         Name.TextWrapped = true
  426.                     end
  427.                 end
  428.             else
  429.                 workspace[owner.Name.." (Ghost)"]:findFirstChild(limb.Name).CFrame = cframe
  430.                 workspace[owner.Name.." (Ghost)"]:findFirstChild(limb.Name).Anchored = true
  431.             end
  432.             if humanbody then
  433.                 for i,v in pairs(owner.Character:GetChildren()) do
  434.                     if v.ClassName == "Part" or v.ClassName == "MeshPart" then
  435.                         physics:SetPartCollisionGroup(v, collisiongroup)
  436.                     end
  437.                 end
  438.                 for i,v in pairs(workspace[owner.Name.." (Ghost)"]:GetChildren()) do
  439.                     if v.ClassName == "Part" or v.ClassName == "MeshPart" then
  440.                         physics:SetPartCollisionGroup(v, collisiongroup)
  441.                     end
  442.                 end
  443.             end
  444.             if humanbody then
  445.                 for i,v in pairs(owner.Character:GetChildren()) do
  446.                     if v.ClassName == "Shirt" or v.ClassName == "Pants" or v.ClassName == "ShirtGraphic" and not workspace[owner.Name.." (Ghost)"]:findFirstChild(v.Name) then
  447.                         v.Archivable = true
  448.                         local cloneme = v:Clone()
  449.                         cloneme.Parent = workspace[owner.Name.." (Ghost)"]
  450.                     end
  451.                     if v.ClassName == "Accessory" and v:findFirstChild("Handle") then
  452.                         if not workspace[owner.Name.." (Ghost)"]:findFirstChild(v.Name) then
  453.                             v.Archivable = true
  454.                             local cloneme = v:Clone()
  455.                             if cloneme.Handle:findFirstChildOfClass("HingeConstraint") then
  456.                                 cloneme.Handle:findFirstChildOfClass("HingeConstraint"):destroy()
  457.                             end
  458.                             if cloneme.Handle:findFirstChildOfClass("Weld") then
  459.                                 cloneme.Handle:findFirstChildOfClass("Weld"):destroy()
  460.                             end
  461.                             cloneme.Handle.Transparency = 0
  462.                             cloneme.Parent = workspace[owner.Name.." (Ghost)"]
  463.                             if workspace[owner.Name.." (Ghost)"]:findFirstChild("Head") then
  464.                                 for q,w in pairs(workspace[owner.Name.." (Ghost)"]:findFirstChild("Head"):GetChildren()) do
  465.                                     if w.ClassName == "Weld" then
  466.                                         w:destroy()
  467.                                     end
  468.                                 end
  469.                                 local weeeld = Instance.new("Weld", cloneme.Handle)
  470.                                 weeeld.C0 = workspace[owner.Name.." (Ghost)"]:findFirstChild("Head").CFrame:toObjectSpace(cloneme.Handle.CFrame)
  471.                                 weeeld.Part0 = workspace[owner.Name.." (Ghost)"]:findFirstChild("Head")
  472.                                 weeeld.Part1 = cloneme.Handle
  473.                             end
  474.                         end
  475.                     end
  476.                 end
  477.             end
  478.         elseif what == "respawn" then
  479.             owner:LoadCharacter()
  480.         end
  481.     end
  482. end
  483. remote.OnServerEvent:connect(event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement