The document contains code for scripting the behavior of a character named JeffTheKiller in the game Roblox. It includes functions for detecting nearby players, attacking players that get too close, playing ambient music and sounds, and animating walking movements. The script manages JeffTheKiller's behavior, movement, attacks, and audio based on interactions with nearby players.
The document contains code for scripting the behavior of a character named JeffTheKiller in the game Roblox. It includes functions for detecting nearby players, attacking players that get too close, playing ambient music and sounds, and animating walking movements. The script manages JeffTheKiller's behavior, movement, attacks, and audio based on interactions with nearby players.
The document contains code for scripting the behavior of a character named JeffTheKiller in the game Roblox. It includes functions for detecting nearby players, attacking players that get too close, playing ambient music and sounds, and animating walking movements. The script manages JeffTheKiller's behavior, movement, attacks, and audio based on interactions with nearby players.
repeat wait(0.1)until JeffTheKillerScript and JeffTheKillerScript.Parent and
JeffTheKillerScript.Parent.ClassName=="Model"and JeffTheKillerScript.Parent:FindFirstChild("Head")and JeffTheKillerScript.Parent:FindFirstChild("Torso"); local JeffTheKiller=JeffTheKillerScript.Parent; function raycast(Spos,vec,currentdist) local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(Spos+ (vec*.05),vec*currentdist),JeffTheKiller); if hit2~=nil and pos2 then if hit2.Name=="Handle" and not hit2.CanCollide or string.sub(hit2.Name,1,6)=="Effect"and not hit2.CanCollide then local currentdist=currentdist-(pos2-Spos).magnitude; return raycast(pos2,vec,currentdist); end; end; return hit2,pos2; end; function RayCast(Position,Direction,MaxDistance,IgnoreList) return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position,Direction .unit*(MaxDistance or 999.999)),IgnoreList); end; local JeffTheKillerHumanoid; for _,Child in pairs(JeffTheKiller:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then JeffTheKillerHumanoid=Child; end; end; local AttackDebounce=false; local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Knife"); local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head"); local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart"); local WalkDebounce=false; local Notice=false; local JeffLaughDebounce=false; local MusicDebounce=false; local NoticeDebounce=false; local ChosenMusic; JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,- 1,0,0,0,0,1,0,1,-0); local OriginalC0=JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0; function FindNearestBae() local NoticeDistance=script.Parent.Values.TargetMagDistance.Value; local TargetMain; for _,TargetModel in pairs(game:GetService("Workspace"):GetChildren())do if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart"); local FoundHumanoid; for _,Child in pairs(TargetModel:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then FoundHumanoid=Child; end; end; if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position- JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then TargetMain=TargetPart; NoticeDistance=(TargetPart.Position- JeffTheKillerHumanoidRootPart.Position).magnitude; local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position- JeffTheKillerHumanoidRootPart.Position).unit,500) if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumaniodRootPart")and hit.Parent:FindFirstChild("Head")then if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<15 and not AttackDebounce then spawn(function() AttackDebounce=true; local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Sw ing")); local SwingChoice=math.random(1,2); local HitChoice=math.random(1,3); SwingAnimation:Play(); SwingAnimation:AdjustSpeed(2.1+(math.random()*0.1)); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife then local SwingSound=JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Swing") SwingSound.Pitch=1+(math.random()*0.04); SwingSound:Play(); end; wait(0.2); if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then FoundHumanoid:TakeDamage(20); if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); end; end; wait(1); AttackDebounce=false; end); end; end; end; end; end; return TargetMain; end; while wait(0.1)do local TargetPoint=JeffTheKillerHumanoid.TargetPoint; local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffT heKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRo otPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/ 2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector, (JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller}) local Jumpable=false; if Blockage then wait(0.5) Jumpable=true; if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then local BlockageHumanoid; for _,Child in pairs(Blockage.Parent:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then BlockageHumanoid=Child; Jumpable=false; end; end; if Blockage and Blockage:IsA("Terrain")then local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0))); local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos .Z); if CellMaterial==Enum.CellMaterial.Water then Jumpable=false; end; elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool" or Blockage.Parent.Name=="Humanoid" and Blockage.Parent.Name=="HumanoidRootPart" and Blockage.Parent.ClassName=="Humanoid" then Jumpable=false; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then JeffTheKillerHumanoid.Jump=true; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("RakeStep")and (JeffTheKillerHumanoidRootPart.Velocity- Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then spawn(function() WalkDebounce=true; local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0)); local RayTarget,endPoint=game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKille r); if RayTarget then local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("RakeStep"):Clone() ; JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead; JeffTheKillerHeadFootStepClone:Play(); JeffTheKillerHeadFootStepClone:Destroy(); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then wait(0.4); elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then wait(0.15); end end; WalkDebounce=false; end); end; local MainTarget=FindNearestBae(); local FoundHumanoid; if MainTarget then for _,Child in pairs(MainTarget.Parent:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then FoundHumanoid=Child; end; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position- JeffTheKillerHumanoidRootPart.Position).magnitude<99999999999999999999 then if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("RakeTheme")and not JeffTheKillerHead:FindFirstChild("RakeTheme").IsPlaying then JeffTheKillerHead:FindFirstChild("RakeTheme").Volume=JeffTheKiller:FindFirstChild(" Configuration"):FindFirstChild("RakeThemeVolume").Value; JeffTheKillerHead:FindFirstChild("RakeTheme"):Play(); end; elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position- JeffTheKillerHumanoidRootPart.Position).magnitude>9999999999999999999 then if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("RakeTheme")and JeffTheKillerHead:FindFirstChild("RakeTheme").IsPlaying then if not JeffLaughDebounce then spawn(function() JeffLaughDebounce=true; repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("RakeTheme")then JeffTheKillerHead:FindFirstChild("RakeTheme").Volume=JeffTheKillerHead:FindFirstChi ld("RakeTheme").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("RakeTheme").Volume==0 or JeffTheKillerHead:FindFirstChild("RakeTheme").Volume<0; JeffTheKillerHead:FindFirstChild("RakeTheme").Volume=0; JeffTheKillerHead:FindFirstChild("RakeTheme"):Stop(); JeffLaughDebounce=false; end); end; end; end; if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position- JeffTheKillerHumanoidRootPart.Position).magnitude<50 then local MusicChoice=math.random(1,2); if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1"); elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2"); end; if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then ChosenMusic.Volume=0.5; ChosenMusic:Play(); end; elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position- JeffTheKillerHumanoidRootPart.Position).magnitude>50 then if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then if not MusicDebounce then spawn(function() MusicDebounce=true; repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0; if ChosenMusic then ChosenMusic.Volume=0; ChosenMusic:Stop(); end; ChosenMusic=nil; MusicDebounce=false; end); end; end; end; if not MainTarget and not JeffLaughDebounce then spawn(function() JeffLaughDebounce=true; repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("RakeTheme")then JeffTheKillerHead:FindFirstChild("RakeTheme").Volume=JeffTheKillerHead:FindFirstChi ld("RakeTheme").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("RakeTheme").Volume==0 or JeffTheKillerHead:FindFirstChild("RakeTheme").Volume<0; JeffTheKillerHead:FindFirstChild("RakeTheme").Volume=0; JeffTheKillerHead:FindFirstChild("RakeTheme"):Stop(); JeffLaughDebounce=false; end); end; if not MainTarget and not MusicDebounce then spawn(function() MusicDebounce=true; repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0; if ChosenMusic then ChosenMusic.Volume=0; ChosenMusic:Stop(); end; ChosenMusic=nil; MusicDebounce=false; end); end; if MainTarget then Notice=true; if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Found")then JeffTheKiller.Values.Target.Value = true; JeffTheKillerHead:FindFirstChild("Found"):Play(); NoticeDebounce=true; local ScreamAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("A nimations").Scream); ScreamAnimation.Priority = Enum.AnimationPriority.Action2 ScreamAnimation:Play(); JeffTheKillerHead:FindFirstChild("RakeScream"):Play(); JeffTheKillerHumanoid.WalkSpeed=5; JeffTheKillerHead.HeadF.Eye1.Material = Enum.Material.Neon JeffTheKillerHead.HeadF.Eye2.Material = Enum.Material.Neon JeffTheKillerHead.HeadF.Eye1Dec.LeftEyeBeam.Enabled = true JeffTheKillerHead.HeadF.Eye2Dec.LeftEyeBeam.Enabled = true wait(0.5); JeffTheKillerHumanoid.WalkSpeed=30; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then JeffTheKillerHumanoid.WalkSpeed=JeffTheKiller.Configuration.WalkSpeed.Value; elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then JeffTheKillerHumanoid.WalkSpeed=1; end; JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position- JeffTheKillerHumanoidRootPart.Position).unit*2,game:GetService("Workspace"):FindFir stChild("Terrain")); local NeckRotation=(JeffTheKiller:FindFirstChild("Torso").Position.Y- MainTarget.Parent:FindFirstChild("Head").Position.Y)/10; if NeckRotation>-1.5 and NeckRotation<1.5 then JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=OriginalC0*CFrame.f romEulerAnglesXYZ(NeckRotation,0,0); end; if NeckRotation<-1.5 then JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,- 1,0,0,0,-0.4,0.1,0,0.1,0.9); elseif NeckRotation>1.5 then JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,- 1,0,0,0,0.1,0.08,0,0.08,-0.2); end; else end; else Notice=false; NoticeDebounce=false; JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,- 1,0,0,0,0,1,0,1,-0); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then JeffTheKillerHead.Breath:Stop() JeffTheKillerHead.HeadF.Eye1.Material = Enum.Material.Plastic JeffTheKillerHead.HeadF.Eye2.Material = Enum.Material.Plastic JeffTheKillerHead.HeadF.Eye1Dec.LeftEyeBeam.Enabled = false JeffTheKillerHead.HeadF.Eye2Dec.LeftEyeBeam.Enabled = false JeffTheKillerHumanoid.WalkSpeed=12; JeffTheKiller.Values.Target.Value=false; end; end; spawn(function() local AlreadyDo=false; while wait(0.1) do if JeffTheKiller.Values.Target.Value==false and AlreadyDo==false then JeffTheKiller.Scripts.Wander.Disabled=false; AlreadyDo=true; wait(5); AlreadyDo=false; end; if JeffTheKiller.Values.Target.Value==true and AlreadyDo==false then JeffTheKiller.Scripts.Wander.Disabled=true; AlreadyDo=true; wait(5); AlreadyDo=false; end; end; end); spawn(function() while JeffTheKillerHumanoid.Health > 1 do wait(1); end; end); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then JeffTheKillerHumanoid.AutoJumpEnabled=true; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then JeffTheKillerHumanoid.AutoRotate=true; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then JeffTheKillerHumanoid.PlatformStand=false; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then JeffTheKillerHumanoid.Sit=false; end; end;