Advertisement
tyridge77

NewGhost

Aug 22nd, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.09 KB | None | 0 0
  1. wait();
  2. script.Parent = nil;
  3.  
  4. local TorsoY = game.Players.LocalPlayer.Character.Torso.CFrame.Y;
  5. local origin = Vector3.new(100,TorsoY,100);
  6. --House = Workspace:WaitForChild("SpookyHouse");
  7. --Base = House.Base;
  8.  
  9. Lighting = game.Lighting;
  10.  
  11. function updatelighting()
  12. Lighting.TimeOfDay = 2;
  13. Lighting.Ambient = Color3.new(0,0,0);
  14. Lighting.GlobalShadows = false;
  15. Lighting.FogColor = Color3.new();
  16. Lighting.FogEnd = 100;
  17. end
  18. --Lighting.Changed:connect(updatelighting);
  19. --updatelighting();
  20.  
  21. function lightc(m)
  22. light = Instance.new("PointLight",m:WaitForChild("Torso"));
  23. end
  24. for _,v in pairs(game.Players:GetPlayers()) do
  25. -- v.CharacterAdded:connect(lightc)
  26. -- lightc(v.Character);
  27. end
  28. newp = game.Players.PlayerAdded:connect(function(v)
  29. -- v.CharacterAdded:connect(lightc)
  30. -- lightc(v.Character);
  31. end)
  32. creaks = {
  33. "138118545",
  34. "177955601"
  35. }
  36. Workspace.ChildRemoved:connect(function(o)
  37. if o.Name == "SpookyHouse" then
  38. House = Workspace:WaitForChild("SpookyHouse");
  39. Base = House.Base;
  40. end
  41. end)
  42.  
  43.  
  44. -- 3 - Handle
  45.  
  46. HatHat = Instance.new("Hat");
  47. HatHat.AttachmentForward = Vector3.new(0, 0, -1);
  48. HatHat.AttachmentPos = Vector3.new(0, 0.4, 0);
  49. HatHat.AttachmentRight = Vector3.new(1, 0, 0);
  50. HatHat.AttachmentUp = Vector3.new(0, 1, 0);
  51. HatHat.Name = "TranslatorHat";
  52.  
  53.  
  54. Hat = Instance.new("Part")
  55. Hat.CFrame = CFrame.new(Vector3.new(-51.7999954, -0.845267892, -34.0000038)) * CFrame.Angles(1.5186921339787e-020, 1.5186921339787e-020, 1.5186921339787e-020)
  56. Hat.FormFactor = Enum.FormFactor.Plate
  57. Hat.CanCollide = false
  58. Hat.TopSurface = Enum.SurfaceType.Smooth
  59. Hat.RotVelocity = Vector3.new(2.66133316e-019, 2.66133316e-019, 2.66133316e-019)
  60. Hat.BottomSurface = Enum.SurfaceType.Smooth
  61. Hat.Size = Vector3.new(2, 0.800000012, 2)
  62. Hat.Velocity = Vector3.new(2.79999888e-019, -22.8900204, 2.79999888e-019)
  63. Hat.Friction = 0.30000001192093
  64. Hat.Shape = Enum.PartType.Block
  65. Hat.Name = "Handle"
  66. Hat.Parent = HatHat;
  67.  
  68. -- 4 - Mesh
  69. obj4 = Instance.new("SpecialMesh")
  70. obj4.Name = "Mesh";
  71. obj4.MeshType = Enum.MeshType.FileMesh
  72. obj4.MeshId = "http://www.roblox.com/asset/?id=33366461"
  73. obj4.TextureId = "http://www.roblox.com/asset/?id=35880763"
  74. obj4.Parent = Hat;
  75.  
  76.  
  77. BillboardGui = Instance.new("BillboardGui");
  78. BillboardGui.AlwaysOnTop = true;
  79. BillboardGui.Size = UDim2.new(2,0,1,0);
  80. BillboardGui.StudsOffset = Vector3.new(0,2,0);
  81.  
  82. Frame = Instance.new("Frame",BillboardGui);
  83. Frame.BackgroundTransparency = 1;
  84. Frame.Position = UDim2.new();
  85. Frame.Size = UDim2.new(1,0,0.3,0);
  86.  
  87. Label = Instance.new("TextLabel",Frame);
  88. Label.BackgroundTransparency = 1;
  89. Label.Position = UDim2.new();
  90. Label.Size = UDim2.new(1,0,1,0);
  91. Label.ZIndex = 1;
  92. Label.Font = "ArialBold";
  93. Label.FontSize = "Size18";
  94. Label.Text = "Spooky Ghost";
  95. Label.TextColor3 = Color3.new(1,1,1);
  96. Label.TextScaled = true;
  97. Label.TextWrapped = true;
  98.  
  99. filtered = {"floak"}
  100. function hatfilter(s)
  101. for _,v in pairs(filtered) do
  102. if s:lower():match(v:lower()) then
  103. return true;
  104. end
  105. end
  106. end
  107.  
  108. lockedcolor = {};
  109.  
  110. local dodging = false;
  111. gchartorsocf = CFrame.new(origin);
  112.  
  113. local player = game.Players.LocalPlayer;
  114. player.Chatted:connect(function(msg)
  115. if msg:match("g/") then
  116. script.Disabled = true;
  117. end
  118. end)
  119. local mouse = player:GetMouse();
  120. local ochar = player.Character;
  121. --ochar.Torso.Anchored = true;
  122. --ochar.Torso.CFrame = CFrame.new(0,1000,0);
  123. for _,v in pairs(ochar.Head:GetChildren()) do
  124. if v:isA("Decal") then v:Destroy() end
  125. end
  126. for _,v in pairs(ochar:GetChildren()) do
  127. if v:isA("Hat") and not hatfilter(v.Name) then v:Destroy() end
  128. if v:isA("Hat") and hatfilter(v.Name) then
  129. v.Handle.BrickColor = BrickColor.new(Color3.new(155/255,0,0));
  130. v.Handle.Name = "HandleRed";
  131. lockedcolor["HandleRed"] = true;
  132. -- v.HandleRed:GetChildren()[1].TextureId = "";
  133. v.HandleRed:GetChildren()[1].VertexColor = Vector3.new(155/255,0,0);
  134. end
  135. end
  136. MyHat = HatHat:clone();
  137. MyHat.Parent = ochar;
  138. MyHatMesh = MyHat.Handle.Mesh;
  139. MyHatMeshScale = MyHatMesh.Scale;
  140.  
  141. ochar.Humanoid.WalkSpeed = 0;
  142. local cam = Workspace.CurrentCamera;
  143. local torso = player.Character.Torso;
  144.  
  145. print("In camera");
  146. local ParticleEmitter = Instance.new("ParticleEmitter");
  147. ParticleEmitter.Color = ColorSequence.new(Color3.new(225/255,0,3/255),Color3.new(125/255,0,3/255));
  148. ParticleEmitter.LightEmission = .75;
  149. ParticleEmitter.Size = NumberSequence.new(1,2);
  150. ParticleEmitter.Texture = "rbxasset://textures/particles/fire_main.dds";
  151. ParticleEmitter.Transparency = NumberSequence.new(0);
  152. ParticleEmitter.Acceleration = Vector3.new(0,-10,0);
  153. ParticleEmitter.Lifetime = NumberRange.new(1);
  154. ParticleEmitter.Rate = 100;
  155. ParticleEmitter.Speed = NumberRange.new(10);
  156. ParticleEmitter.VelocitySpread = 155;
  157.  
  158. Smoke = ParticleEmitter:clone();
  159. Smoke.Color = ColorSequence.new(Color3.new(255/255,255/255,255/255));
  160. Smoke.LightEmission = .3;
  161. Smoke.Size = NumberSequence.new(30);
  162. Smoke.Acceleration = Vector3.new(0,0,0);
  163. Smoke.Speed = NumberRange.new(1);
  164. Smoke.Transparency = NumberSequence.new(0.05);
  165.  
  166. SpookyGhost = Instance.new("Sound");
  167. SpookyGhost.SoundId = "http://roblox.com/asset/?ID=151703542";
  168. SpookyGhost.Volume = 1;
  169.  
  170. Boo = Instance.new("Sound");
  171. Boo.SoundId = "http://roblox.com/asset?id=183657145";
  172. Boo.Volume = 1;
  173.  
  174. local rst = game:GetService("RunService").RenderStepped;
  175.  
  176. local PlayerScripts = game.Players.LocalPlayer.PlayerScripts;
  177. local input = game:GetService("UserInputService");
  178.  
  179.  
  180. function getprop(v,str)
  181. local e,r = pcall(function() prop = v[str] end)
  182. return e;
  183. end
  184. function s(p,b)
  185. for _,v in pairs(p:GetChildren()) do
  186. if getprop(v,"Locked") then v.Locked = false; end
  187. if getprop(v,"Archivable") then v.Archivable = true; end
  188. if (v:isA("BasePart") or v:isA("Mesh")) then
  189. if b then v.Name = math.random();
  190. local val = Instance.new("StringValue",v.Parent);
  191. val.Name = v.Name;
  192. end
  193. else
  194. s(v);
  195. end
  196. end
  197. end
  198.  
  199. s(ochar,false);
  200.  
  201. function bm(v)
  202. if v.Name ~= "Head" then
  203. local mesh = Instance.new("BlockMesh",v);
  204. mesh.Scale = Vector3.new(1,.65,1);
  205. else
  206. for _,v in pairs(v:GetChildren()) do
  207. if v:isA("Mesh") or v:isA("SpecialMesh") then
  208. v.Scale = Vector3.new(v.Scale.X,.6,v.Scale.Z);
  209. end
  210. end
  211. end
  212. end
  213.  
  214. function MakeNoob(pos)
  215. ochar.Archivable = true;
  216. char = ochar:clone();
  217. char.Name = "Part";
  218. nameGui = BillboardGui:clone();
  219. nameGui.Parent = char.Head;
  220. for _,v in pairs(char:GetChildren()) do
  221. if v:isA("BasePart") then
  222. if not lockedcolor[v.Name] then
  223. v.BrickColor = BrickColor.new("White");
  224. v.Transparency = .8;
  225. end
  226. v.Size = v.Size+Vector3.new(0,1,0) bm(v);
  227. end
  228. end
  229. char.Humanoid:Destroy();
  230. for _,v in pairs(char:GetChildren()) do if v:isA("Script") or v:isA("LocalScript") then v:Destroy() end end
  231. char.Torso.CFrame = pos or CFrame.new(origin);
  232. if ochar.Parent ~= Workspace.CurrentCamera then ochar.Parent = Workspace.CurrentCamera; end
  233. return char;
  234. end
  235.  
  236. function Weld(w)
  237. w.MaxVelocity = .1
  238. local part0 = w.Part0;
  239. local part1 = w.Part1;
  240. local c=CFrame.new(part0.Position)
  241. local part0cf = part0.CFrame:toObjectSpace(c)
  242. w.C0=part0cf
  243. w.C1=part1.CFrame:toObjectSpace(c)
  244. end
  245. function removechar(char)
  246. for _,v in pairs(char:GetChildren()) do
  247. v:ClearAllChildren();
  248. if v:isA("BasePart") then v.Transparency = 1; end
  249. removechar(v);
  250. end
  251. end
  252.  
  253. function invis(char,b)
  254. for _,v in pairs(char:GetChildren()) do
  255. if v:isA("BasePart") and v ~= dodgebox then
  256. if b then
  257. v.Transparency = 1;
  258. elseif v.Name ~="Handle" and not v.Parent:isA("Hat") then
  259. v.Transparency = 0.8;
  260. elseif v.Name =="Handle" or v.Parent:isA("Hat") then
  261. v.Transparency = 0;
  262. end
  263. else
  264. invis(v,b);
  265. end
  266. end
  267. end
  268.  
  269.  
  270. function MakeChar(pos)
  271. if char then char:MoveTo(Vector3.new(0,-500,0)) end
  272. char = nil;
  273. chartorso = nil;
  274. char = MakeNoob(pos); char.Name = "Part";
  275. char:MoveTo(Vector3.new(100,0,100));
  276. char:MakeJoints();
  277. wait()
  278. char.Parent = Workspace.CurrentCamera
  279. for _,v in pairs(char:GetChildren()) do
  280. if v:isA("BasePart") and not v.Name:match("Leg") then
  281. v.Archivable = true;
  282. v.CanCollide = false
  283. end
  284. end
  285. chartorso = char.Torso;
  286. SmokeParticles = Smoke:clone();
  287. SmokeParticles.Parent = chartorso;
  288. SmokeParticles.Enabled = false;
  289. BooSound = Boo:clone();
  290. BooSound.Parent = chartorso;
  291. SpookyGhostSound = SpookyGhost:clone();
  292. SpookyGhostSound.Parent = chartorso;
  293. chartorso.Anchored = true;
  294. chartorso.Locked = false;
  295. ls = chartorso:FindFirstChild("Left Shoulder");
  296. rs = chartorso:FindFirstChild("Right Shoulder");
  297. lh = chartorso:FindFirstChild("Left Hip");
  298. rh = chartorso:FindFirstChild("Right Hip");
  299. if not ls or not rs or not lh or not rh then
  300. MakeChar(pos);
  301. return;
  302. end
  303. lsc0,rsc0 = ls.C0,rs.C0;
  304. head = char.Head;
  305. human = game.Players.LocalPlayer.Character.Humanoid;
  306. --dodgebox = Instance.new("Part");
  307. dodgebox = chartorso:Clone();
  308. dodgebox.Parent = char;
  309. dodgebox.Anchored = false;
  310. dodgebox.Name = "DodgeBox";
  311. dodgebox:ClearAllChildren();
  312. dodgebox.Transparency = 1;
  313. dodgebox.Size = Vector3.new(30,30,30);
  314. weld = Instance.new("Motor6D",chartorso);
  315. weld.Part1 = chartorso;
  316. weld.Part0 = dodgebox;
  317. Weld(weld);
  318. rootpart = char.HumanoidRootPart;
  319. cam.CameraSubject = char.Head;
  320. s(char,true);
  321.  
  322. local touchdeb = false;
  323. touchedevent = dodgebox.Touched:connect(function(o)
  324. if o:isDescendantOf(char) or (not dodging) or touchdeb then
  325. return;
  326. end
  327. touchdeb = true;
  328. chartorso.CFrame = chartorso.CFrame*CFrame.new(math.random(-20,20),0,math.random(-20,20));
  329. wait(.1);
  330. touchdeb = false;
  331. end)
  332. torsotouch = chartorso.Touched:connect(function(o)
  333. if not o.Name:match("Base") and collide then
  334. o:Destroy();
  335. end
  336. end)
  337. local disconnected = false;
  338. event = char.DescendantRemoving:connect(function()
  339. if disconnected then return end
  340. event:disconnect();
  341. disconnected = true;
  342. print("NEW CHARACTER");
  343. MakeChar(gchartorsocf)
  344. end)
  345.  
  346. SmokeParticles.Enabled = smokeenabled;
  347. invis(char,invisible);
  348. -- MyHatMesh.Scale = invisible and Vector3.new(0,0,0) or MyHatMeshScale;
  349. nameGui.Enabled = not invisible;
  350. end
  351. MakeChar();
  352.  
  353. collide = false;
  354. invisible = false;
  355. spookyghost = false;
  356. smokeenabled = false;
  357.  
  358.  
  359. mouse.KeyDown:connect(function(key)
  360. if key == "z" then
  361. dodging = not dodging;
  362. print("Dodging: ",dodging);
  363. end
  364. if key == "g" then
  365. collide = not collide;
  366. print("Collide: ",collide);
  367. end
  368. if key == "c" then
  369. invisible = not invisible;
  370. print("Invisible: ",invisible);
  371. if char then
  372. invis(char,invisible);
  373. -- MyHatMesh.Scale = invisible and Vector3.new(0,0,0) or MyHatMeshScale;
  374. nameGui.Enabled = not invisible;
  375. end
  376. end
  377. if key == "n" then
  378. spookyghost = not spookyghost;
  379. print("SpookyGhost: ",spookyghost);
  380. if spookyghost then
  381. SpookyGhostSound:Play();
  382. else
  383. SpookyGhostSound:Stop();
  384. end
  385. end
  386. if key == "m" then
  387. print("Boo");
  388. BooSound.Pitch = math.random(80,120)/100;
  389. wait();
  390. BooSound:Play();
  391. end
  392. if key == "k" then
  393. print("Smoke");
  394. smokeenabled = not smokeenabled;
  395. SmokeParticles.Enabled = smokeenabled;
  396. end
  397. end)
  398.  
  399.  
  400. filter = {};
  401. speed = 1;
  402.  
  403. function findNeck()
  404. local ray = Ray.new(mouse.UnitRay.Origin,mouse.UnitRay.Direction*50);
  405. local targ,pos = Workspace:FindPartOnRayWithIgnoreList(ray,{char,Workspace.CurrentCamera});
  406. if not targ or not targ.Parent then return end
  407. local model = targ.Parent;
  408. if model:FindFirstChild("Torso") then
  409. local torso = model:FindFirstChild("Torso");
  410. if torso:FindFirstChild("Neck") and not filter[torso.Neck] then
  411. return torso.Neck;
  412. end
  413. elseif targ:FindFirstChild("Neck") and not Filter[targ.Neck] then
  414. return targ.Neck;
  415. elseif model.Parent and model.Parent:FindFirstChild("Torso") then
  416. local torso = model.Parent:FindFirstChild("Torso");
  417. if torso:FindFirstChild("Neck") and not filter[torso.Neck] then
  418. return torso.Neck;
  419. end
  420. end
  421. end
  422. lastcreak = 0;
  423. creaktime = math.random(10,30);
  424. particlesArray = {};
  425. while true do
  426. local time = Workspace.DistributedGameTime;
  427.  
  428. for _,v in pairs(particlesArray) do
  429. local particles,t,trans,neck = unpack(v);
  430. if time-t>=2 then
  431. particles.Enabled = false;
  432. if time-t>= 3 then
  433. particlesArray[_]=nil;
  434. particles:Destroy();
  435. neck:Destroy();
  436. end
  437. else
  438. v[3]=v[3]+0.01;
  439. particles.Transparency = NumberSequence.new(v[3]);
  440. end
  441. end
  442. if char and chartorso then
  443. if input:isKeyDown(Enum.KeyCode.T) then
  444. if mouse.Target and mouse.Target.Parent and not mouse.Target:isDescendantOf(char) then
  445. if not mouse.Target.Name:lower():match("base") then
  446. mouse.Target:Destroy();
  447. end
  448. end
  449. end
  450. if input:isKeyDown(Enum.KeyCode.LeftShift) then
  451. speed = 4;
  452. else
  453. speed = 1;
  454. end
  455. if input:isKeyDown(Enum.KeyCode.X) and not inWorkspace then
  456. inWorkspace = true;
  457. char.Parent = Workspace; char.Name = "Part";
  458. end
  459. if input:isKeyDown(Enum.KeyCode.W) then
  460. walking = 1;
  461. stat = nil;
  462. elseif input:isKeyDown(Enum.KeyCode.S) then
  463. walking = -1
  464. stat = nil;
  465. else
  466. stat = math.sin(time)*0.01;
  467. walking = nil
  468. end
  469. if input:isKeyDown(Enum.KeyCode.F) then
  470. foundneck = foundneck or findNeck();
  471. if foundneck then
  472. raisingneck = true;
  473. if not scream then
  474. scream = Instance.new("Sound",foundneck.Parent);
  475. scream.SoundId = "http://roblox.com/asset/?ID=271550300";
  476. scream.Volume = .5;
  477. scream:Play();
  478. end
  479. end
  480. else
  481. if lastneck then
  482. if scream then scream:Stop(); scream:Destroy(); scream = nil; end
  483. filter[lastneck]=true;
  484. if nls then nls.C0 = lsc0; end
  485. if nrs then nrs.C0 = rsc0; end
  486. local head = lastneck.Part1;
  487. local particles = ParticleEmitter:clone();
  488. particles.Parent = head;
  489. particles.Enabled = true;
  490. particlesArray[#particlesArray+1]={particles,time,0,lastneck};
  491. pop = Instance.new("Sound",lastneck.Parent)
  492. pop.SoundId = "http://roblox.com/asset/?ID=130779171";
  493. pop.Volume = 1;
  494. pop:Play();
  495. local mod = head.Parent;
  496. for _,v in pairs(mod:GetChildren()) do if v:isA("Hat") then v:Destroy() end end
  497. head.Transparency = 1;
  498. if head:FindFirstChild("face") then head.face:Destroy() end
  499. if head:FindFirstChild("Face") then head.Face:Destroy() end
  500. end
  501. lastneck = false;
  502. foundneck = false;
  503. raisingneck = false;
  504. end
  505. if raisingneck and foundneck then
  506. rsc0lock = rsc0 * CFrame.Angles(0,0,math.rad(90+45));
  507. foundneck.C0=foundneck.C0 *CFrame.new(0,0,.01)
  508. if foundneck.Parent and foundneck.Parent:FindFirstChild("Left Shoulder") and foundneck.Parent:FindFirstChild("Right Shoulder") then
  509. local nrs,nls = foundneck.Parent["Right Shoulder"],foundneck.Parent["Left Shoulder"];
  510. nrs.C0 = rsc0*CFrame.Angles(math.rad(90+45),math.rad(90),0)
  511. nls.C0 = lsc0*CFrame.Angles(math.rad(90+45),math.rad(90),0)
  512.  
  513. end
  514. else
  515. rsc0lock = nil;
  516. end
  517. lastneck = foundneck;
  518. local chartorsocf = CFrame.new(chartorso.CFrame.X,TorsoY,chartorso.CFrame.Z);
  519. local cf = walking and CFrame.new(chartorso.Position+chartorso.CFrame.lookVector*((.3*walking)*speed)) or chartorsocf;
  520. cf = CFrame.new(cf.p,cf.p+cam.CoordinateFrame.lookVector*Vector3.new(10,0,10));
  521. cf = cf*CFrame.new(0,stat or 0,0);
  522. ls.C0 = not walking and lsc0*CFrame.new(0,stat*7,0) or lsc0;
  523. rs.C0 = rsc0lock or (not walking and rsc0*CFrame.new(0,stat*7,0) or rsc0);
  524.  
  525. chartorso.CFrame = cf;
  526.  
  527. if walking then
  528.  
  529. local sin = math.sin(time*10);
  530. local desangle = 1.1 * sin;
  531. rh.DesiredAngle = desangle;
  532. rs.DesiredAngle = desangle;
  533. lh.DesiredAngle = desangle;
  534. ls.DesiredAngle = desangle;
  535. else
  536. rh.DesiredAngle,rs.DesiredAngle,lh.DesiredAngle,ls.DesiredAngle = 0,0,0,0;
  537. end
  538.  
  539. gchartorsocf = chartorso.CFrame;
  540. end
  541. if time-lastcreak>=creaktime and House and Base then
  542. lastcreak = time;
  543. creaktime = math.random(10,30);
  544. local creak = Instance.new("Sound",Base);
  545. creak.SoundId = "http://roblox.com/asset/?ID=177955601";
  546. creak.Volume = 1;
  547. creak.Pitch = math.random(90,100)/100;
  548. creak:Play();
  549. game.Debris:AddItem(creak,30);
  550. end
  551. rst:wait();
  552. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement