Untitled

Run Settings
LanguageLua
Language Version
Run Command
-- other things -- -- Create a new model to represent the NPC local NPC = Instance.new("Model") NPC.Name = "NPC" -- Create the head part local head = Instance.new("Part") head.Name = "Head" head.Size = Vector3.new(2, 2, 2) head.BrickColor = BrickColor.new("Bright yellow") head.Parent = NPC -- Create the torso part local torso = Instance.new("Part") torso.Name = "Torso" torso.Size = Vector3.new(2, 3, 1) torso.BrickColor = BrickColor.new("Bright blue") torso.Parent = NPC -- Create the left arm part local leftArm = Instance.new("Part") leftArm.Name = "LeftArm" leftArm.Size = Vector3.new(1, 2, 1) leftArm.BrickColor = BrickColor.new("Bright red") leftArm.Parent = NPC -- Create the right arm part local rightArm = Instance.new("Part") rightArm.Name = "RightArm" rightArm.Size = Vector3.new(1, 2, 1) rightArm.BrickColor = BrickColor.new("Bright red") rightArm.Parent = NPC -- Create the left leg part local leftLeg = Instance.new("Part") leftLeg.Name = "LeftLeg" leftLeg.Size = Vector3.new(1, 2, 1) leftLeg.BrickColor = BrickColor.new("Bright green") leftLeg.Parent = NPC -- Create the right leg part local rightLeg = Instance.new("Part") rightLeg.Name = "RightLeg" rightLeg.Size = Vector3.new(1, 2, 1) rightLeg.BrickColor = BrickColor.new("Bright green") rightLeg.Parent = NPC -- Set the primary part of the NPC to the torso NPC.PrimaryPart = torso -- Position the NPC in the workspace NPC:SetPrimaryPartCFrame(CFrame.new(0, 5, 0)) -- Parent the NPC to the workspace to make it visible NPC.Parent = workspace --creates humanoid local hum = Instance.new("Humanoid") hum.Parent = torso ---------- BIG ---------------------------- -- ass local PathfindingService = game:GetService("PathfindingService") local npc = game.Workspace.NPC local followDistance = 5 while true do local player = owner local character = player.Character if character and character:FindFirstChild("HumanoidRootPart") then local distance = (npc.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Magnitude if distance <= followDistance then local path = PathfindingService:CreatePath() path:ComputeAsync(npc.HumanoidRootPart.Position, character.HumanoidRootPart.Position) for _, waypoint in ipairs(path:GetWaypoints()) do NPC.Humanoid:MoveTo(waypoint.Position) NPC.Humanoid.MoveToFinished:Wait() end end end end wait(1) end
Editor Settings
Theme
Key bindings
Full width
Lines