Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --By Rufus14, its like a couple months old i have no idea why i havent released it yet
- local players = game:GetService("Players")
- local remotefolder = game:GetService("TestService")
- local THEhideout = game:GetService("Chat")
- local debris = game:GetService("Debris")
- local remotename = "LCDN "..owner.Name
- local modelname = "deez"..string.lower(owner.Name)
- local remote
- local hideout
- local oldhp
- local currentmodel
- bodytype = "ghost"
- state = "normal"
- visible = true
- ghosttransparency = 0.9
- ghostmaterial = "Glass"
- modelitselfrefit = true
- bodyparts = {}
- decaltransparency = {}
- if not remotefolder:FindFirstChild(remotename) then
- remote = Instance.new("RemoteEvent", remotefolder)
- remote.Name = remotename
- else
- remote = remotefolder[remotename]
- end
- if not THEhideout:FindFirstChild("Workspace") then --create fake workspace when someone prints ur parent on server
- hideout = Instance.new("Folder", THEhideout)
- hideout.Name = "Workspace"
- else
- hideout = THEhideout.Workspace
- end
- function findalreadyusedlimb(limbe)
- for i,v in pairs(bodyparts) do
- if v[1] == limbe then
- return v
- end
- end
- end
- function findalreadyuseddecal(decale)
- for i,v in pairs(decaltransparency) do
- if v[1] == decale then
- return v[2]
- end
- end
- end
- function limbtransparency(tra)
- for i,v in pairs(owner.Character:GetDescendants()) do
- if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
- v.Transparency = tra
- end
- end
- end
- function cleartable(tabl)
- table.foreach(tabl, function(hi,a) tabl[hi] = nil end)
- end
- function humanattributes(modelddddddd)
- local tempyhuj = Instance.new("Humanoid", modelddddddd)
- tempyhuj.Health = tempyhuj.MaxHealth
- tempyhuj.DisplayName = owner.DisplayName
- tempyhuj.Died:Connect(function()
- removmodl()
- end)
- if owner.Character:FindFirstChildOfClass("Shirt") then
- owner.Character:FindFirstChildOfClass("Shirt"):Clone().Parent = modelddddddd
- end
- if owner.Character:FindFirstChildOfClass("Pants") then
- owner.Character:FindFirstChildOfClass("Pants"):Clone().Parent = modelddddddd
- end
- if owner.Character:FindFirstChildOfClass("ShirtGraphic") then
- owner.Character:FindFirstChildOfClass("ShirtGraphic"):Clone().Parent = modelddddddd
- end
- end
- function creatmodl()
- if currentmodel == nil or currentmodel.Parent == nil then
- local model = Instance.new("Model", workspace)
- model.Name = modelname
- if bodytype == "human" then
- humanattributes(model)
- end
- if modelitselfrefit then
- model.AncestryChanged:Connect(function()
- if not model:IsDescendantOf(workspace) and modelitselfrefit and state == "ghosted" then
- debris:AddItem(model, 0)
- creatmodl()
- end
- end)
- end
- currentmodel = model
- return false
- else
- return true
- end
- end
- function removmodl()
- if currentmodel ~= nil or currentmodel.Parent ~= nil then
- currentmodel:Destroy()
- end
- end
- function movemodl(toparent)
- if currentmodel ~= nil or currentmodel.Parent ~= nil then
- currentmodel.Parent = toparent
- end
- end
- function beam(position, scale, duration, material, ssssss)
- if ssssss then
- local sp = Instance.new("SpawnLocation", workspace)
- sp.Neutral = false
- sp.Anchored = true
- sp.Size = Vector3.new(0.1,0.1,0.1)
- sp.Transparency = 1
- sp.CanCollide = false
- sp.CFrame = CFrame.new(position)
- local sou = Instance.new("Sound", sp)
- sou.SoundId = "http://www.roblox.com/asset/?id=2767090"
- sou.Volume = 2
- sou:Play()
- game.Debris:AddItem(sp, 3)
- end
- local b = Instance.new("SpawnLocation", workspace)
- b.Neutral = false
- b.Material = material
- b.Size = Vector3.new(1000,scale,scale)
- b.Anchored = true
- b.CanCollide = false
- b.CFrame = CFrame.new(position)
- b.CFrame = b.CFrame * CFrame.fromEulerAnglesXYZ(0,0,math.pi/2)
- coroutine.wrap(function()
- local amount = scale/duration
- local transparencyamount = 1/duration
- for i = 1,duration do
- b.Size = b.Size - Vector3.new(0,amount,amount)
- b.Transparency = b.Transparency + transparencyamount
- game:GetService("RunService").Stepped:wait()
- end
- b:Destroy()
- end)()
- end
- function thelimb(LIMB)
- if currentmodel.Parent ~= nil then
- local tr = findalreadyusedlimb(LIMB)
- if tr ~= nil then
- LIMB.Transparency = tr[3]
- if state ~= "ghosted" then
- tr = nil
- end
- end
- local p = Instance.new("SpawnLocation")
- p.Parent = currentmodel
- p:SetNetworkOwner(owner)
- p.Neutral = false
- p.CanCollide = false
- p.Size = LIMB.Size
- if bodytype == "ghost" then
- p.Material = "Glass"
- if LIMB.Name ~= "Head" then
- p.Size = LIMB.Size + Vector3.new(0.1,0.1,0.1)
- end
- p.BrickColor = BrickColor.Black()
- p.Transparency = ghosttransparency
- elseif bodytype == "human" then
- p.Material = p.Material
- p.Name = LIMB.Name
- p.Color = LIMB.Color
- p.Transparency = tr
- if LIMB:FindFirstChildOfClass("Decal") then
- LIMB:FindFirstChildOfClass("Decal"):Clone().Parent = p
- local transp = findalreadyuseddecal(LIMB:FindFirstChildOfClass("Decal"))
- if transp ~= nil then
- p:FindFirstChildOfClass("Decal").Transparency = transp
- end
- end
- end
- p.AncestryChanged:Connect(function(parent)
- if not p:IsDescendantOf(workspace) and state == "ghosted" and visible then
- debris:AddItem(p,0) --to prevent people from lagging the game by loop parenting limbs to like lighting for example
- thelimb(LIMB)
- end
- end)
- local b = Instance.new("BodyVelocity", p)
- b.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- b.Velocity = Vector3.new()
- if LIMB:FindFirstChildOfClass("SpecialMesh") then
- LIMB:FindFirstChildOfClass("SpecialMesh"):Clone().Parent = p
- if bodytype == "ghost" then
- p:FindFirstChildOfClass("SpecialMesh").TextureId = ""
- p:FindFirstChildOfClass("SpecialMesh").Scale = p:FindFirstChildOfClass("SpecialMesh").Scale + Vector3.new(0.1,0.1,0.1)
- end
- elseif LIMB.ClassName == "MeshPart" then
- local h = Instance.new("SpecialMesh", p)
- h.MeshId = LIMB.MeshId
- if bodytype == "human" then
- h.TextureId = LIMB.TextureID
- end
- end
- local args = {LIMB, p, LIMB.Transparency}
- if state ~= "ghosted" then
- table.insert(bodyparts, args)
- end
- LIMB.Transparency = 1
- remote:FireClient(owner, "applybpart", args)
- end
- end
- function ghosteffect()
- if state ~= "ghosted" then
- cleartable(bodyparts)
- cleartable(decaltransparency)
- end
- creatmodl()
- if bodytype == "human" then
- local dddddd = workspace:FindFirstChild(modelname)
- humanattributes(dddddd)
- end
- for i,v in pairs(owner.Character:GetDescendants()) do
- if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
- thelimb(v)
- elseif v.ClassName == "Texture" or v.ClassName == "Decal" then
- if state ~= "ghosted" then
- table.insert(decaltransparency, {v, v.Transparency})
- end
- v.Transparency = 1
- end
- end
- end
- remote.OnServerEvent:Connect(function(plr, WHAT, param1, param2, param3)
- if plr == owner then
- if WHAT == "ghost please" then
- owner.Character.Parent = hideout
- oldhp = owner.Character:FindFirstChildOfClass("Humanoid").MaxHealth
- owner.Character:FindFirstChildOfClass("Humanoid").MaxHealth = math.huge
- owner.Character:FindFirstChildOfClass("Humanoid").Health = owner.Character:FindFirstChildOfClass("Humanoid").MaxHealth
- local fff = Instance.new("ForceField", owner.Character)
- fff.Visible = false
- fff.Name = "zamknij morde"
- remote:FireClient(owner, "ghosting")
- ghosteffect()
- state = "ghosted"
- if not visible then
- removmodl()
- limbtransparency(0.5)
- end
- --print("hidden")
- elseif WHAT == "unghost please" then
- state = "normal"
- table.foreach(bodyparts, function(a,b) b[2]:Destroy() b[1].Transparency = b[3] end)
- table.foreach(decaltransparency, function(a,b) b[1].Transparency = b[2] end)
- owner.Character.Parent = workspace
- if owner.Character:FindFirstChild("zamknij morde") then
- owner.Character:FindFirstChild("zamknij morde"):Destroy()
- end
- owner.Character:FindFirstChildOfClass("Humanoid").MaxHealth = oldhp
- remote:FireClient(owner, "unghosting")
- removmodl()
- --print("unghosted")
- elseif WHAT == "switchbodytype" then
- if bodytype == "ghost" then
- bodytype = "human"
- elseif bodytype == "human" then
- bodytype = "ghost"
- end
- removmodl()
- elseif WHAT == "switchvisibility" then
- visible = not visible
- if not visible then
- if state == "ghosted" then
- removmodl()
- limbtransparency(0.5)
- end
- else
- if state == "ghosted" then
- ghosteffect()
- limbtransparency(1)
- end
- end
- remote:FireClient(owner, "changedbodytype")
- elseif WHAT == "beamremote" then
- beam(param1, 6.5, 15, param2, param3)
- end
- end
- end)
- script.Parent = game:GetService("ServerScriptService")
- NLS([[local players = game:GetService("Players")
- local remotefolder = game:GetService("TestService")
- local runservice = game:GetService("RunService")
- local localplayer = players.LocalPlayer
- local mouse = localplayer:GetMouse()
- local remotename = "LCDN "..localplayer.Name
- local remote = remotefolder:WaitForChild(remotename, math.huge)
- _G.ghostkey = "x"
- _G.visiblekey = "c"
- _G.bodytypekey = "v"
- print(_G.ghostkey.." to ghost")
- print(_G.visiblekey.." for visibility")
- print(_G.bodytypekey.." to change body type")
- bodytype = "ghost"
- state = "normal"
- network = "none"
- visible = true
- muffledaudios = {}
- function cleartable(t)
- for i,v in pairs(t) do t[i] = nil end
- end
- function muffleaudio(audio)
- local meffect = Instance.new("EqualizerSoundEffect", audio)
- meffect.HighGain = -20
- meffect.LowGain = 0
- meffect.MidGain = -20
- meffect.Name = "{}{}{}][}{}{}}{}["
- table.insert(muffledaudios, audio)
- end
- function muffleallaudios()
- for i,v in pairs(workspace:GetDescendants()) do
- if v.ClassName == "Sound" then
- muffleaudio(v)
- end
- end
- end
- function unmuffleaudios()
- for i,v in pairs(muffledaudios) do
- if v.Parent ~= nil then
- if v:FindFirstChild("{}{}{}][}{}{}}{}[") then
- v["{}{}{}][}{}{}}{}["]:Destroy()
- end
- end
- end
- cleartable(muffledaudios)
- end
- mouse.KeyDown:Connect(function(key)
- if key == _G.ghostkey and network == "none" then
- network = "pending ghost"
- if state == "normal" then
- remote:FireServer("ghost please")
- elseif state == "ghosted" then
- remote:FireServer("unghost please")
- end
- elseif key == _G.bodytypekey then
- remote:FireServer("switchbodytype")
- elseif key == _G.visiblekey then
- remote:FireServer("switchvisibility")
- end
- end)
- function cfloop(reallimb, fakelimb)
- coroutine.wrap(function()
- while runservice.Stepped:wait() and reallimb.Parent ~= nil and fakelimb.Parent ~= nil do
- fakelimb.CFrame = reallimb.CFrame
- fakelimb.CanCollide = false
- end
- end)()
- end
- workspace.DescendantAdded:Connect(function(WHAT)
- if WHAT.ClassName == "Sound" and state == "ghosted" then
- muffleaudio(WHAT)
- end
- end)
- remote.OnClientEvent:Connect(function(WHAT, param1)
- if network == "pending ghost" then
- if WHAT == "ghosting" then --when u get ghosted
- localplayer.Character.Parent = workspace
- state = "ghosted"
- local cc = Instance.new("ColorCorrectionEffect", workspace.CurrentCamera)
- cc.TintColor = Color3.fromRGB(200,255,255)
- cc.Name = "houlding"
- coroutine.wrap(function()
- local oldf = workspace.CurrentCamera.FieldOfView
- workspace.CurrentCamera.FieldOfView = oldf + 5
- for i = 1,25 do
- workspace.CurrentCamera.FieldOfView = (oldf+5)-(i/5)
- if state == "ghosted" then
- wait()
- end
- end
- workspace.CurrentCamera.FieldOfView = oldf
- end)()
- remote:FireServer("beamremote", localplayer.Character.Head.Position, "Neon", true)
- muffleallaudios()
- elseif WHAT == "unghosting" then
- if workspace.CurrentCamera:FindFirstChild("houlding") then
- workspace.CurrentCamera.houlding:Destroy()
- end
- unmuffleaudios()
- remote:FireServer("beamremote", localplayer.Character.Head.Position, "Neon", true)
- state = "normal"
- end
- network = "none"
- end
- if WHAT == "applybpart" then
- cfloop(param1[1], param1[2])
- elseif WHAT == "changedbodytype" then
- remote:FireServer("beamremote", localplayer.Character.Head.Position, "ForceField", false)
- end
- end)
- script.Parent = localplayer:FindFirstChildOfClass("PlayerScripts")
- ]], owner.Character)
Add Comment
Please, Sign In to add comment