Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait();
- script.Parent = nil;
- local TorsoY = game.Players.LocalPlayer.Character.Torso.CFrame.Y;
- local origin = Vector3.new(100,TorsoY,100);
- --House = Workspace:WaitForChild("SpookyHouse");
- --Base = House.Base;
- Lighting = game.Lighting;
- function updatelighting()
- Lighting.TimeOfDay = 2;
- Lighting.Ambient = Color3.new(0,0,0);
- Lighting.GlobalShadows = false;
- Lighting.FogColor = Color3.new();
- Lighting.FogEnd = 100;
- end
- --Lighting.Changed:connect(updatelighting);
- --updatelighting();
- function lightc(m)
- light = Instance.new("PointLight",m:WaitForChild("Torso"));
- end
- for _,v in pairs(game.Players:GetPlayers()) do
- -- v.CharacterAdded:connect(lightc)
- -- lightc(v.Character);
- end
- newp = game.Players.PlayerAdded:connect(function(v)
- -- v.CharacterAdded:connect(lightc)
- -- lightc(v.Character);
- end)
- creaks = {
- "138118545",
- "177955601"
- }
- Workspace.ChildRemoved:connect(function(o)
- if o.Name == "SpookyHouse" then
- House = Workspace:WaitForChild("SpookyHouse");
- Base = House.Base;
- end
- end)
- -- 3 - Handle
- HatHat = Instance.new("Hat");
- HatHat.AttachmentForward = Vector3.new(0, 0, -1);
- HatHat.AttachmentPos = Vector3.new(0, 0.4, 0);
- HatHat.AttachmentRight = Vector3.new(1, 0, 0);
- HatHat.AttachmentUp = Vector3.new(0, 1, 0);
- HatHat.Name = "TranslatorHat";
- Hat = Instance.new("Part")
- Hat.CFrame = CFrame.new(Vector3.new(-51.7999954, -0.845267892, -34.0000038)) * CFrame.Angles(1.5186921339787e-020, 1.5186921339787e-020, 1.5186921339787e-020)
- Hat.FormFactor = Enum.FormFactor.Plate
- Hat.CanCollide = false
- Hat.TopSurface = Enum.SurfaceType.Smooth
- Hat.RotVelocity = Vector3.new(2.66133316e-019, 2.66133316e-019, 2.66133316e-019)
- Hat.BottomSurface = Enum.SurfaceType.Smooth
- Hat.Size = Vector3.new(2, 0.800000012, 2)
- Hat.Velocity = Vector3.new(2.79999888e-019, -22.8900204, 2.79999888e-019)
- Hat.Friction = 0.30000001192093
- Hat.Shape = Enum.PartType.Block
- Hat.Name = "Handle"
- Hat.Parent = HatHat;
- -- 4 - Mesh
- obj4 = Instance.new("SpecialMesh")
- obj4.Name = "Mesh";
- obj4.MeshType = Enum.MeshType.FileMesh
- obj4.MeshId = "http://www.roblox.com/asset/?id=33366461"
- obj4.TextureId = "http://www.roblox.com/asset/?id=35880763"
- obj4.Parent = Hat;
- BillboardGui = Instance.new("BillboardGui");
- BillboardGui.AlwaysOnTop = true;
- BillboardGui.Size = UDim2.new(2,0,1,0);
- BillboardGui.StudsOffset = Vector3.new(0,2,0);
- Frame = Instance.new("Frame",BillboardGui);
- Frame.BackgroundTransparency = 1;
- Frame.Position = UDim2.new();
- Frame.Size = UDim2.new(1,0,0.3,0);
- Label = Instance.new("TextLabel",Frame);
- Label.BackgroundTransparency = 1;
- Label.Position = UDim2.new();
- Label.Size = UDim2.new(1,0,1,0);
- Label.ZIndex = 1;
- Label.Font = "ArialBold";
- Label.FontSize = "Size18";
- Label.Text = "Spooky Ghost";
- Label.TextColor3 = Color3.new(1,1,1);
- Label.TextScaled = true;
- Label.TextWrapped = true;
- filtered = {"floak"}
- function hatfilter(s)
- for _,v in pairs(filtered) do
- if s:lower():match(v:lower()) then
- return true;
- end
- end
- end
- lockedcolor = {};
- local dodging = false;
- gchartorsocf = CFrame.new(origin);
- local player = game.Players.LocalPlayer;
- player.Chatted:connect(function(msg)
- if msg:match("g/") then
- script.Disabled = true;
- end
- end)
- local mouse = player:GetMouse();
- local ochar = player.Character;
- --ochar.Torso.Anchored = true;
- --ochar.Torso.CFrame = CFrame.new(0,1000,0);
- for _,v in pairs(ochar.Head:GetChildren()) do
- if v:isA("Decal") then v:Destroy() end
- end
- for _,v in pairs(ochar:GetChildren()) do
- if v:isA("Hat") and not hatfilter(v.Name) then v:Destroy() end
- if v:isA("Hat") and hatfilter(v.Name) then
- v.Handle.BrickColor = BrickColor.new(Color3.new(155/255,0,0));
- v.Handle.Name = "HandleRed";
- lockedcolor["HandleRed"] = true;
- -- v.HandleRed:GetChildren()[1].TextureId = "";
- v.HandleRed:GetChildren()[1].VertexColor = Vector3.new(155/255,0,0);
- end
- end
- MyHat = HatHat:clone();
- MyHat.Parent = ochar;
- MyHatMesh = MyHat.Handle.Mesh;
- MyHatMeshScale = MyHatMesh.Scale;
- ochar.Humanoid.WalkSpeed = 0;
- local cam = Workspace.CurrentCamera;
- local torso = player.Character.Torso;
- print("In camera");
- local ParticleEmitter = Instance.new("ParticleEmitter");
- ParticleEmitter.Color = ColorSequence.new(Color3.new(225/255,0,3/255),Color3.new(125/255,0,3/255));
- ParticleEmitter.LightEmission = .75;
- ParticleEmitter.Size = NumberSequence.new(1,2);
- ParticleEmitter.Texture = "rbxasset://textures/particles/fire_main.dds";
- ParticleEmitter.Transparency = NumberSequence.new(0);
- ParticleEmitter.Acceleration = Vector3.new(0,-10,0);
- ParticleEmitter.Lifetime = NumberRange.new(1);
- ParticleEmitter.Rate = 100;
- ParticleEmitter.Speed = NumberRange.new(10);
- ParticleEmitter.VelocitySpread = 155;
- Smoke = ParticleEmitter:clone();
- Smoke.Color = ColorSequence.new(Color3.new(255/255,255/255,255/255));
- Smoke.LightEmission = .3;
- Smoke.Size = NumberSequence.new(30);
- Smoke.Acceleration = Vector3.new(0,0,0);
- Smoke.Speed = NumberRange.new(1);
- Smoke.Transparency = NumberSequence.new(0.05);
- SpookyGhost = Instance.new("Sound");
- SpookyGhost.SoundId = "http://roblox.com/asset/?ID=151703542";
- SpookyGhost.Volume = 1;
- Boo = Instance.new("Sound");
- Boo.SoundId = "http://roblox.com/asset?id=183657145";
- Boo.Volume = 1;
- local rst = game:GetService("RunService").RenderStepped;
- local PlayerScripts = game.Players.LocalPlayer.PlayerScripts;
- local input = game:GetService("UserInputService");
- function getprop(v,str)
- local e,r = pcall(function() prop = v[str] end)
- return e;
- end
- function s(p,b)
- for _,v in pairs(p:GetChildren()) do
- if getprop(v,"Locked") then v.Locked = false; end
- if getprop(v,"Archivable") then v.Archivable = true; end
- if (v:isA("BasePart") or v:isA("Mesh")) then
- if b then v.Name = math.random();
- local val = Instance.new("StringValue",v.Parent);
- val.Name = v.Name;
- end
- else
- s(v);
- end
- end
- end
- s(ochar,false);
- function bm(v)
- if v.Name ~= "Head" then
- local mesh = Instance.new("BlockMesh",v);
- mesh.Scale = Vector3.new(1,.65,1);
- else
- for _,v in pairs(v:GetChildren()) do
- if v:isA("Mesh") or v:isA("SpecialMesh") then
- v.Scale = Vector3.new(v.Scale.X,.6,v.Scale.Z);
- end
- end
- end
- end
- function MakeNoob(pos)
- ochar.Archivable = true;
- char = ochar:clone();
- char.Name = "Part";
- nameGui = BillboardGui:clone();
- nameGui.Parent = char.Head;
- for _,v in pairs(char:GetChildren()) do
- if v:isA("BasePart") then
- if not lockedcolor[v.Name] then
- v.BrickColor = BrickColor.new("White");
- v.Transparency = .8;
- end
- v.Size = v.Size+Vector3.new(0,1,0) bm(v);
- end
- end
- char.Humanoid:Destroy();
- for _,v in pairs(char:GetChildren()) do if v:isA("Script") or v:isA("LocalScript") then v:Destroy() end end
- char.Torso.CFrame = pos or CFrame.new(origin);
- if ochar.Parent ~= Workspace.CurrentCamera then ochar.Parent = Workspace.CurrentCamera; end
- return char;
- end
- function Weld(w)
- w.MaxVelocity = .1
- local part0 = w.Part0;
- local part1 = w.Part1;
- local c=CFrame.new(part0.Position)
- local part0cf = part0.CFrame:toObjectSpace(c)
- w.C0=part0cf
- w.C1=part1.CFrame:toObjectSpace(c)
- end
- function removechar(char)
- for _,v in pairs(char:GetChildren()) do
- v:ClearAllChildren();
- if v:isA("BasePart") then v.Transparency = 1; end
- removechar(v);
- end
- end
- function invis(char,b)
- for _,v in pairs(char:GetChildren()) do
- if v:isA("BasePart") and v ~= dodgebox then
- if b then
- v.Transparency = 1;
- elseif v.Name ~="Handle" and not v.Parent:isA("Hat") then
- v.Transparency = 0.8;
- elseif v.Name =="Handle" or v.Parent:isA("Hat") then
- v.Transparency = 0;
- end
- else
- invis(v,b);
- end
- end
- end
- function MakeChar(pos)
- if char then char:MoveTo(Vector3.new(0,-500,0)) end
- char = nil;
- chartorso = nil;
- char = MakeNoob(pos); char.Name = "Part";
- char:MoveTo(Vector3.new(100,0,100));
- char:MakeJoints();
- wait()
- char.Parent = Workspace.CurrentCamera
- for _,v in pairs(char:GetChildren()) do
- if v:isA("BasePart") and not v.Name:match("Leg") then
- v.Archivable = true;
- v.CanCollide = false
- end
- end
- chartorso = char.Torso;
- SmokeParticles = Smoke:clone();
- SmokeParticles.Parent = chartorso;
- SmokeParticles.Enabled = false;
- BooSound = Boo:clone();
- BooSound.Parent = chartorso;
- SpookyGhostSound = SpookyGhost:clone();
- SpookyGhostSound.Parent = chartorso;
- chartorso.Anchored = true;
- chartorso.Locked = false;
- ls = chartorso:FindFirstChild("Left Shoulder");
- rs = chartorso:FindFirstChild("Right Shoulder");
- lh = chartorso:FindFirstChild("Left Hip");
- rh = chartorso:FindFirstChild("Right Hip");
- if not ls or not rs or not lh or not rh then
- MakeChar(pos);
- return;
- end
- lsc0,rsc0 = ls.C0,rs.C0;
- head = char.Head;
- human = game.Players.LocalPlayer.Character.Humanoid;
- --dodgebox = Instance.new("Part");
- dodgebox = chartorso:Clone();
- dodgebox.Parent = char;
- dodgebox.Anchored = false;
- dodgebox.Name = "DodgeBox";
- dodgebox:ClearAllChildren();
- dodgebox.Transparency = 1;
- dodgebox.Size = Vector3.new(30,30,30);
- weld = Instance.new("Motor6D",chartorso);
- weld.Part1 = chartorso;
- weld.Part0 = dodgebox;
- Weld(weld);
- rootpart = char.HumanoidRootPart;
- cam.CameraSubject = char.Head;
- s(char,true);
- local touchdeb = false;
- touchedevent = dodgebox.Touched:connect(function(o)
- if o:isDescendantOf(char) or (not dodging) or touchdeb then
- return;
- end
- touchdeb = true;
- chartorso.CFrame = chartorso.CFrame*CFrame.new(math.random(-20,20),0,math.random(-20,20));
- wait(.1);
- touchdeb = false;
- end)
- torsotouch = chartorso.Touched:connect(function(o)
- if not o.Name:match("Base") and collide then
- o:Destroy();
- end
- end)
- local disconnected = false;
- event = char.DescendantRemoving:connect(function()
- if disconnected then return end
- event:disconnect();
- disconnected = true;
- print("NEW CHARACTER");
- MakeChar(gchartorsocf)
- end)
- SmokeParticles.Enabled = smokeenabled;
- invis(char,invisible);
- -- MyHatMesh.Scale = invisible and Vector3.new(0,0,0) or MyHatMeshScale;
- nameGui.Enabled = not invisible;
- end
- MakeChar();
- collide = false;
- invisible = false;
- spookyghost = false;
- smokeenabled = false;
- mouse.KeyDown:connect(function(key)
- if key == "z" then
- dodging = not dodging;
- print("Dodging: ",dodging);
- end
- if key == "g" then
- collide = not collide;
- print("Collide: ",collide);
- end
- if key == "c" then
- invisible = not invisible;
- print("Invisible: ",invisible);
- if char then
- invis(char,invisible);
- -- MyHatMesh.Scale = invisible and Vector3.new(0,0,0) or MyHatMeshScale;
- nameGui.Enabled = not invisible;
- end
- end
- if key == "n" then
- spookyghost = not spookyghost;
- print("SpookyGhost: ",spookyghost);
- if spookyghost then
- SpookyGhostSound:Play();
- else
- SpookyGhostSound:Stop();
- end
- end
- if key == "m" then
- print("Boo");
- BooSound.Pitch = math.random(80,120)/100;
- wait();
- BooSound:Play();
- end
- if key == "k" then
- print("Smoke");
- smokeenabled = not smokeenabled;
- SmokeParticles.Enabled = smokeenabled;
- end
- end)
- filter = {};
- speed = 1;
- function findNeck()
- local ray = Ray.new(mouse.UnitRay.Origin,mouse.UnitRay.Direction*50);
- local targ,pos = Workspace:FindPartOnRayWithIgnoreList(ray,{char,Workspace.CurrentCamera});
- if not targ or not targ.Parent then return end
- local model = targ.Parent;
- if model:FindFirstChild("Torso") then
- local torso = model:FindFirstChild("Torso");
- if torso:FindFirstChild("Neck") and not filter[torso.Neck] then
- return torso.Neck;
- end
- elseif targ:FindFirstChild("Neck") and not Filter[targ.Neck] then
- return targ.Neck;
- elseif model.Parent and model.Parent:FindFirstChild("Torso") then
- local torso = model.Parent:FindFirstChild("Torso");
- if torso:FindFirstChild("Neck") and not filter[torso.Neck] then
- return torso.Neck;
- end
- end
- end
- lastcreak = 0;
- creaktime = math.random(10,30);
- particlesArray = {};
- while true do
- local time = Workspace.DistributedGameTime;
- for _,v in pairs(particlesArray) do
- local particles,t,trans,neck = unpack(v);
- if time-t>=2 then
- particles.Enabled = false;
- if time-t>= 3 then
- particlesArray[_]=nil;
- particles:Destroy();
- neck:Destroy();
- end
- else
- v[3]=v[3]+0.01;
- particles.Transparency = NumberSequence.new(v[3]);
- end
- end
- if char and chartorso then
- if input:isKeyDown(Enum.KeyCode.T) then
- if mouse.Target and mouse.Target.Parent and not mouse.Target:isDescendantOf(char) then
- if not mouse.Target.Name:lower():match("base") then
- mouse.Target:Destroy();
- end
- end
- end
- if input:isKeyDown(Enum.KeyCode.LeftShift) then
- speed = 4;
- else
- speed = 1;
- end
- if input:isKeyDown(Enum.KeyCode.X) and not inWorkspace then
- inWorkspace = true;
- char.Parent = Workspace; char.Name = "Part";
- end
- if input:isKeyDown(Enum.KeyCode.W) then
- walking = 1;
- stat = nil;
- elseif input:isKeyDown(Enum.KeyCode.S) then
- walking = -1
- stat = nil;
- else
- stat = math.sin(time)*0.01;
- walking = nil
- end
- if input:isKeyDown(Enum.KeyCode.F) then
- foundneck = foundneck or findNeck();
- if foundneck then
- raisingneck = true;
- if not scream then
- scream = Instance.new("Sound",foundneck.Parent);
- scream.SoundId = "http://roblox.com/asset/?ID=271550300";
- scream.Volume = .5;
- scream:Play();
- end
- end
- else
- if lastneck then
- if scream then scream:Stop(); scream:Destroy(); scream = nil; end
- filter[lastneck]=true;
- if nls then nls.C0 = lsc0; end
- if nrs then nrs.C0 = rsc0; end
- local head = lastneck.Part1;
- local particles = ParticleEmitter:clone();
- particles.Parent = head;
- particles.Enabled = true;
- particlesArray[#particlesArray+1]={particles,time,0,lastneck};
- pop = Instance.new("Sound",lastneck.Parent)
- pop.SoundId = "http://roblox.com/asset/?ID=130779171";
- pop.Volume = 1;
- pop:Play();
- local mod = head.Parent;
- for _,v in pairs(mod:GetChildren()) do if v:isA("Hat") then v:Destroy() end end
- head.Transparency = 1;
- if head:FindFirstChild("face") then head.face:Destroy() end
- if head:FindFirstChild("Face") then head.Face:Destroy() end
- end
- lastneck = false;
- foundneck = false;
- raisingneck = false;
- end
- if raisingneck and foundneck then
- rsc0lock = rsc0 * CFrame.Angles(0,0,math.rad(90+45));
- foundneck.C0=foundneck.C0 *CFrame.new(0,0,.01)
- if foundneck.Parent and foundneck.Parent:FindFirstChild("Left Shoulder") and foundneck.Parent:FindFirstChild("Right Shoulder") then
- local nrs,nls = foundneck.Parent["Right Shoulder"],foundneck.Parent["Left Shoulder"];
- nrs.C0 = rsc0*CFrame.Angles(math.rad(90+45),math.rad(90),0)
- nls.C0 = lsc0*CFrame.Angles(math.rad(90+45),math.rad(90),0)
- end
- else
- rsc0lock = nil;
- end
- lastneck = foundneck;
- local chartorsocf = CFrame.new(chartorso.CFrame.X,TorsoY,chartorso.CFrame.Z);
- local cf = walking and CFrame.new(chartorso.Position+chartorso.CFrame.lookVector*((.3*walking)*speed)) or chartorsocf;
- cf = CFrame.new(cf.p,cf.p+cam.CoordinateFrame.lookVector*Vector3.new(10,0,10));
- cf = cf*CFrame.new(0,stat or 0,0);
- ls.C0 = not walking and lsc0*CFrame.new(0,stat*7,0) or lsc0;
- rs.C0 = rsc0lock or (not walking and rsc0*CFrame.new(0,stat*7,0) or rsc0);
- chartorso.CFrame = cf;
- if walking then
- local sin = math.sin(time*10);
- local desangle = 1.1 * sin;
- rh.DesiredAngle = desangle;
- rs.DesiredAngle = desangle;
- lh.DesiredAngle = desangle;
- ls.DesiredAngle = desangle;
- else
- rh.DesiredAngle,rs.DesiredAngle,lh.DesiredAngle,ls.DesiredAngle = 0,0,0,0;
- end
- gchartorsocf = chartorso.CFrame;
- end
- if time-lastcreak>=creaktime and House and Base then
- lastcreak = time;
- creaktime = math.random(10,30);
- local creak = Instance.new("Sound",Base);
- creak.SoundId = "http://roblox.com/asset/?ID=177955601";
- creak.Volume = 1;
- creak.Pitch = math.random(90,100)/100;
- creak:Play();
- game.Debris:AddItem(creak,30);
- end
- rst:wait();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement