Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --By Rufus14
- --owner = game.Players:FindFirstChild(script.Parent.Name)
- NLS([[
- localplr = game:GetService("Players").LocalPlayer
- gui = localplr:findFirstChildOfClass("PlayerGui")
- print("waiting for gui and remote")
- local ghostgui = gui:WaitForChild("Ghost_Gui")
- local viewport = ghostgui:WaitForChild("Ghost")
- local remote = ghostgui:WaitForChild("GhostRemote")
- localplr.Character.Archivable = true
- local clone = localplr.Character:Clone()
- clone.Name = "(Your last position.)"
- for i,v in pairs(clone:GetChildren()) do
- if v.ClassName == "Script" or v.ClassName == "LocalScript" then
- v.Disabled = true
- end
- if v:findFirstChildOfClass("Sound") then
- v:findFirstChildOfClass("Sound"):destroy()
- end
- if v.ClassName == "Sound" then
- v:destroy()
- end
- if v.ClassName == "MeshPart" or v.ClassName == "Part" then
- v.Anchored = true
- end
- if v:findFirstChildOfClass("Decal") then
- v:findFirstChildOfClass("Decal").Transparency = 0
- end
- if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0
- end
- if v.Name == "HumanoidRootPart" then
- v.Transparency = 1
- end
- if v.ClassName == "Accessory" then
- if v:findFirstChild("Handle") then
- if v:findFirstChild("Handle").ClassName == "Part" then
- v:findFirstChild("Handle").Transparency = 0
- end
- end
- end
- end
- clone.Parent = viewport
- viewport.CurrentCamera = workspace.CurrentCamera
- localplr.Character.Parent = workspace
- print("ghosted")
- print("showed last position")
- function uncollide()
- if localplr.Character.Torso.Transparency >= 0.8 then
- for i,v in pairs(localplr.Character:GetChildren()) do
- if v.Name == "Head" or v.Name == "Torso" then
- v.CanCollide = false
- end
- end
- end
- end
- game:GetService("RunService").Stepped:connect(uncollide)
- function ded()
- ghostgui:destroy()
- remote:FireServer("a", "a", "respawn")
- end
- localplr.Character:findFirstChildOfClass("Humanoid").Died:connect(ded)
- function checkwhatadded(wat)
- if wat.Name == "EnterTheShadowRealm" then
- wat:destroy()
- localplr.Character.Parent = workspace
- if viewport:findFirstChild("(Your last position.)") then
- viewport:findFirstChild("(Your last position.)"):destroy()
- end
- localplr.Character.Archivable = true
- local clone = localplr.Character:Clone()
- clone.Name = "(Your last position.)"
- for i,v in pairs(clone:GetChildren()) do
- if v.ClassName == "Script" or v.ClassName == "LocalScript" then
- v.Disabled = true
- end
- if v:findFirstChildOfClass("Sound") then
- v:findFirstChildOfClass("Sound"):destroy()
- end
- if v.ClassName == "Sound" then
- v:destroy()
- end
- if v.ClassName == "MeshPart" or v.ClassName == "Part" then
- v.Anchored = true
- end
- if v:findFirstChildOfClass("Decal") then
- v:findFirstChildOfClass("Decal").Transparency = 0
- end
- if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0
- end
- if v.Name == "HumanoidRootPart" then
- v.Transparency = 1
- end
- if v.ClassName == "Accessory" then
- if v:findFirstChild("Handle") then
- if v:findFirstChild("Handle").ClassName == "Part" then
- v:findFirstChild("Handle").Transparency = 0
- end
- end
- end
- end
- clone.Parent = viewport
- end
- end
- localplr.Character.DescendantAdded:connect(checkwhatadded)
- while game:GetService("RunService").RenderStepped:wait() do
- for i,v in pairs(localplr.Character:GetChildren()) do
- if v.ClassName == "Part" or v.ClassName == "MeshPart" then
- remote:FireServer(v, v.CFrame, "position")
- end
- end
- end
- ]], owner.Character)
- print("making gui")
- local screengui = Instance.new("ScreenGui", owner:findFirstChildOfClass("PlayerGui"))
- local remote = Instance.new("RemoteEvent", screengui)
- remote.Name = "GhostRemote"
- local viewport = Instance.new("ViewportFrame", screengui)
- viewport.BackgroundTransparency = 1
- viewport.ImageTransparency = 0.7
- viewport.Name = "Ghost"
- viewport.Size = UDim2.new(1,0,1,36)
- viewport.Position = viewport.Position + UDim2.new(0,0,0,-36)
- screengui.ResetOnSpawn = true
- -- Farewell Infortality.
- -- Version: 2.82
- -- Instances:
- local ghostbutton = Instance.new("TextButton")
- local visible = Instance.new("TextButton")
- local human = Instance.new("TextButton")
- local whattodo = Instance.new("TextLabel")
- local credits = Instance.new("TextLabel")
- --Properties:
- ghostbutton.Name = "ghostbutton"
- ghostbutton.Parent = screengui
- ghostbutton.BackgroundColor3 = Color3.new(1, 1, 1)
- ghostbutton.Position = UDim2.new(0.618315041, 0, 0.0375169665, 0)
- ghostbutton.Size = UDim2.new(0, 235, 0, 32)
- ghostbutton.Font = Enum.Font.GothamSemibold
- ghostbutton.Text = "Ghost: On"
- ghostbutton.TextColor3 = Color3.new(0, 0, 0)
- ghostbutton.TextSize = 30
- ghostbutton.TextWrapped = true
- visible.Name = "visible"
- visible.Parent = screengui
- visible.BackgroundColor3 = Color3.new(1, 1, 1)
- visible.Position = UDim2.new(0.446153849, 0, 0.0375169665, 0)
- visible.Size = UDim2.new(0, 235, 0, 32)
- visible.Font = Enum.Font.GothamSemibold
- visible.Text = "Visible: On"
- visible.TextColor3 = Color3.new(0, 0, 0)
- visible.TextSize = 30
- visible.TextWrapped = true
- human.Name = "humanbutton"
- human.Parent = screengui
- human.BackgroundColor3 = Color3.new(1, 1, 1)
- human.Position = UDim2.new(0.447, 0, 0, 64)
- human.Size = UDim2.new(0, 470, 0, 32)
- human.Font = Enum.Font.GothamSemibold
- human.Text = "Body Type: Ghost"
- human.TextColor3 = Color3.new(0, 0, 0)
- human.TextSize = 30
- human.TextWrapped = true
- whattodo.Name = "whattodo"
- whattodo.Parent = screengui
- whattodo.BackgroundTransparency = 1
- whattodo.TextTransparency = 1
- whattodo.Position = UDim2.new(0.447, 0, 0, 92)
- whattodo.Size = UDim2.new(0, 470, 0, 32)
- whattodo.Font = Enum.Font.GothamSemibold
- whattodo.Text = "If you are getting pushed, ghost yourself again."
- whattodo.TextColor3 = Color3.new(0, 0, 0)
- whattodo.TextScaled = true
- whattodo.TextWrapped = true
- credits.Name = "credits"
- credits.Parent = screengui
- credits.BackgroundTransparency = 1
- credits.Position = UDim2.new(0.447, 0, 0, 125)
- credits.Size = UDim2.new(0, 470, 0, 32)
- credits.Font = Enum.Font.GothamSemibold
- credits.TextColor3 = Color3.new(0, 0, 0)
- credits.TextScaled = true
- credits.TextWrapped = true
- credits.Text = "By Rufus14"
- owner.Character.Parent = viewport
- screengui.Name = "Ghost_Gui"
- isghost = true
- isvisible = true
- humanbody = false
- for i,v in pairs(owner.Character:GetChildren()) do
- if v:findFirstChildOfClass("Decal") then
- v:findFirstChildOfClass("Decal").Transparency = 1
- end
- if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0.9
- end
- if v.Name == "HumanoidRootPart" then
- v.Transparency = 1
- end
- if v.ClassName == "Accessory" then
- if v:findFirstChild("Handle") then
- if v:findFirstChild("Handle").ClassName == "Part" then
- v:findFirstChild("Handle").Transparency = 1
- end
- end
- end
- end
- function clickedghost()
- if isghost then
- isghost = false
- ghostbutton.Text = "Ghost: Off"
- for i,v in pairs(owner.Character:GetChildren()) do
- if v:findFirstChildOfClass("Decal") then
- v:findFirstChildOfClass("Decal").Transparency = 0
- end
- if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0
- end
- if v.Name == "HumanoidRootPart" then
- v.Transparency = 1
- end
- if v.ClassName == "Accessory" then
- if v:findFirstChild("Handle") then
- if v:findFirstChild("Handle").ClassName == "Part" then
- v:findFirstChild("Handle").Transparency = 0
- end
- end
- end
- end
- owner.Character.Parent = workspace
- for i,v in pairs(owner.Character:GetChildren()) do
- if v.ClassName == "Accessory" then
- local hingee = v.Handle:findFirstChildOfClass("HingeConstraint")
- if hingee then
- hingee:destroy()
- end
- end
- end
- for i,v in pairs(owner.Character:GetChildren()) do
- if v.ClassName == "Accessory" then
- v.Handle.CanCollide = false
- local attachment1 = v.Handle:findFirstChildOfClass("Attachment")
- if attachment1 then
- for q,w in pairs(owner.Character:GetChildren()) do
- if w.ClassName == "Part" or w.ClassName == "MeshPart" then
- local attachment2 = w:findFirstChild(attachment1.Name)
- if attachment2 then
- local hinge = Instance.new("HingeConstraint", v.Handle)
- hinge.Attachment0 = attachment1
- hinge.Attachment1 = attachment2
- hinge.LimitsEnabled = true
- hinge.LowerAngle = 0
- hinge.UpperAngle = 0
- hinge.Name = "hatholder"
- end
- end
- end
- end
- end
- end
- else
- isghost = true
- ghostbutton.Text = "Ghost: On"
- owner.Character.Parent = viewport
- local bool = Instance.new("BoolValue", owner.Character)
- bool.Name = "EnterTheShadowRealm"
- game.Debris:AddItem(bool, 0.1)
- for i,v in pairs(owner.Character:GetChildren()) do
- if v:findFirstChildOfClass("Decal") then
- v:findFirstChildOfClass("Decal").Transparency = 1
- end
- if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "HumanoidRootPart" then
- v.Transparency = 0.9
- end
- if v.Name == "HumanoidRootPart" then
- v.Transparency = 1
- end
- if v.ClassName == "Accessory" then
- if v:findFirstChild("Handle") then
- if v:findFirstChild("Handle").ClassName == "Part" then
- v:findFirstChild("Handle").Transparency = 1
- end
- end
- end
- end
- end
- end
- function clickedhuman()
- if humanbody then
- humanbody = false
- human.Text = "Body Type: Ghost"
- whattodo.TextTransparency = 1
- if isghost then
- human.Active = false
- isghost = false
- wait(0.5)
- local faaaace = owner.Character.Head:findFirstChildOfClass("Decal")
- if faaaace then
- faaaace.Transparency = 1
- end
- human.Active = true
- isghost = true
- end
- else
- humanbody = true
- human.Text = "Body Type: Human"
- whattodo.TextTransparency = 0
- if isghost then
- human.Active = false
- isghost = false
- wait(0.5)
- local faaaace = owner.Character.Head:findFirstChildOfClass("Decal")
- if faaaace then
- faaaace.Transparency = 1
- end
- human.Active = true
- isghost = true
- end
- end
- end
- function clickedvisible()
- if isvisible then
- isvisible = false
- visible.Text = "Visible: Off"
- else
- isvisible = true
- visible.Text = "Visible: On"
- end
- end
- human.MouseButton1Click:connect(clickedhuman)
- visible.MouseButton1Click:connect(clickedvisible)
- ghostbutton.MouseButton1Click:connect(clickedghost)
- local physics = game:GetService("PhysicsService")
- collisiongroup = "ghost"
- function event(plr, limb, cframe, what)
- if plr == owner then
- if what == "position" then
- if humanbody then
- physics:RemoveCollisionGroup(collisiongroup)
- local collisiongroup = "ghost"
- physics:CreateCollisionGroup(collisiongroup)
- physics:CollisionGroupSetCollidable(collisiongroup, collisiongroup, false)
- end
- if not isvisible or not isghost then
- if workspace:findFirstChild(owner.Name.." (Ghost)") then
- workspace:findFirstChild(owner.Name.." (Ghost)"):destroy()
- end
- return
- end
- if not workspace:findFirstChild(owner.Name.." (Ghost)") then
- Instance.new("Model", workspace).Name = owner.Name.." (Ghost)"
- end
- if humanbody then
- if not workspace:findFirstChild(owner.Name.." (Ghost)"):findFirstChildOfClass("Humanoid") then
- Instance.new("Humanoid", workspace:findFirstChild(owner.Name.." (Ghost)")).Name = "Ghost"
- end
- end
- if not workspace[owner.Name.." (Ghost)"]:findFirstChild(limb.Name) then
- local part = Instance.new("Part", workspace[owner.Name.." (Ghost)"])
- part.Size = limb.Size
- if humanbody then
- part.Material = limb.Material
- part.Transparency = 0
- part.BrickColor = limb.BrickColor
- else
- if owner.Name == "Rufus14" then
- part.BrickColor = limb.BrickColor
- else
- part.BrickColor = BrickColor.new("Institutional white")
- end
- part.Material = "ForceField"
- part.Transparency = 0.6
- end
- part.Anchored = true
- part.Name = limb.Name
- part.CanCollide = false
- part.CFrame = cframe
- if part.Name == "HumanoidRootPart" then
- part.Transparency = 1
- end
- if part.Name == "Head" then
- if humanbody then
- local meeeesh = owner.Character.Head:findFirstChildOfClass("SpecialMesh")
- local faaaace = owner.Character.Head:findFirstChildOfClass("Decal")
- if faaaace then
- faaaace.Archivable = true
- faaaace.Transparency = 0
- local cloneme = faaaace:Clone()
- cloneme.Parent = part
- end
- if meeeesh then
- meeeesh.Archivable = true
- local cloneme = meeeesh:Clone()
- cloneme.Parent = part
- end
- end
- if not part:findFirstChild("Text") and not humanbody then
- -- Farewell Infortality.
- -- Version: 2.82
- -- Instances:
- local Text = Instance.new("BillboardGui")
- local Name = Instance.new("TextLabel")
- --Properties:
- Text.Name = "Text"
- Text.Parent = part
- Text.Size = UDim2.new(2, 0, 2, 0)
- Text.StudsOffset = Vector3.new(-4, 2, 0)
- Name.Name = "Name"
- Name.Parent = Text
- Name.BackgroundTransparency = 1
- Name.Size = UDim2.new(5, 0, 1, 0)
- Name.Font = Enum.Font.GothamSemibold
- Name.Text = owner.Name.." (Ghost)"
- Name.TextColor3 = Color3.new(1, 1, 1)
- Name.TextScaled = true
- Name.TextSize = 3
- Name.TextWrapped = true
- end
- end
- else
- workspace[owner.Name.." (Ghost)"]:findFirstChild(limb.Name).CFrame = cframe
- workspace[owner.Name.." (Ghost)"]:findFirstChild(limb.Name).Anchored = true
- end
- if humanbody then
- for i,v in pairs(owner.Character:GetChildren()) do
- if v.ClassName == "Part" or v.ClassName == "MeshPart" then
- physics:SetPartCollisionGroup(v, collisiongroup)
- end
- end
- for i,v in pairs(workspace[owner.Name.." (Ghost)"]:GetChildren()) do
- if v.ClassName == "Part" or v.ClassName == "MeshPart" then
- physics:SetPartCollisionGroup(v, collisiongroup)
- end
- end
- end
- if humanbody then
- for i,v in pairs(owner.Character:GetChildren()) do
- if v.ClassName == "Shirt" or v.ClassName == "Pants" or v.ClassName == "ShirtGraphic" and not workspace[owner.Name.." (Ghost)"]:findFirstChild(v.Name) then
- v.Archivable = true
- local cloneme = v:Clone()
- cloneme.Parent = workspace[owner.Name.." (Ghost)"]
- end
- if v.ClassName == "Accessory" and v:findFirstChild("Handle") then
- if not workspace[owner.Name.." (Ghost)"]:findFirstChild(v.Name) then
- v.Archivable = true
- local cloneme = v:Clone()
- if cloneme.Handle:findFirstChildOfClass("HingeConstraint") then
- cloneme.Handle:findFirstChildOfClass("HingeConstraint"):destroy()
- end
- if cloneme.Handle:findFirstChildOfClass("Weld") then
- cloneme.Handle:findFirstChildOfClass("Weld"):destroy()
- end
- cloneme.Handle.Transparency = 0
- cloneme.Parent = workspace[owner.Name.." (Ghost)"]
- if workspace[owner.Name.." (Ghost)"]:findFirstChild("Head") then
- for q,w in pairs(workspace[owner.Name.." (Ghost)"]:findFirstChild("Head"):GetChildren()) do
- if w.ClassName == "Weld" then
- w:destroy()
- end
- end
- local weeeld = Instance.new("Weld", cloneme.Handle)
- weeeld.C0 = workspace[owner.Name.." (Ghost)"]:findFirstChild("Head").CFrame:toObjectSpace(cloneme.Handle.CFrame)
- weeeld.Part0 = workspace[owner.Name.." (Ghost)"]:findFirstChild("Head")
- weeeld.Part1 = cloneme.Handle
- end
- end
- end
- end
- end
- elseif what == "respawn" then
- owner:LoadCharacter()
- end
- end
- end
- remote.OnServerEvent:connect(event)
Add Comment
Please, Sign In to add comment