Blinking NPCS | V.1.0

Ever wanted your NPCs to feel as advanced as ever? As of today, I have developed a script that allows your NPCs to blink, adding a sense of realism to your developments!

SHOWCASE


DOWNLOAD:
Omari’s NPC Blinking System.rbxm (10.6 KB)

Setting up

To make your NPCs start blinking, all you have to do is download the fbx file from above, or you can do so right here:
Omari’s NPC Blinking System.rbxm (10.6 KB)

After that, you can import it into your own Roblox development. Make sure your NPC has a decal inside of its head named “Eyes” as this displays when the NPC blinks. Without it, I’m sure the NPC script is bound to fail.

Making players blink

At the moment, there is only one way to make the blinking script work for players. And that is to put the script inside the head of a StarterCharacter, and I’m sure you know how that works.

Thank you for using my asset! No credit is required, but if you’d like to support me, you can check out my profile, where I showcase lots of things! - Omari - Roblox

18 Likes

Im sorry if im rude but, isnt this just switching a decal back and forwards?
Like this:

local Eyes = "rbxassetid://blah blah"
local Blink = "rbxassetid://blah blah"
local Rig = script.Parent
local Head = Rig.Head
local face = Head:FindFirstChildWhichIsA("Decal")

while task.wait(10) do
  face.Image = Eyes
  task.wait(0.5)
  face.Image = Blink
  task.wait(0.5)
  face.Image = Eyes
end
2 Likes

Basically yes, since this is the code

-- Services
local RunService = game:GetService("RunService")

-- Variables
local character = script.Parent
local eyes = character:WaitForChild("Head"):WaitForChild("Eyes")

-- Texture IDs
local normalTexture = "http://www.roblox.com/asset/?id=12520202472"
local blinkTexture = "http://www.roblox.com/asset/?id=12520204479"

-- Control variable
local isBlinking = true

-- Function to handle blinking
local function blinkLoop()
	while isBlinking do
		-- Stay in normal state for a random amount of time
		eyes.Texture = normalTexture
		wait(math.random(3, 7)) -- Random wait between blinks

		-- Blink
		eyes.Texture = blinkTexture
		wait(0.15 + math.random() * 0.2) -- Random blink length (0.15 to 0.35 seconds)

		-- Back to normal
		eyes.Texture = normalTexture
	end
end

-- Run the blink loop in a coroutine so it doesn't block other scripts
coroutine.wrap(blinkLoop)()

I feel like this isnt really advanced at all since its basically this… no hate to the creator tho

2 Likes

I believe what he means is that the NPCs appear more advanced and dynamic, rather than basic and generic like using the same face for every character. Of course, anyone can create simple NPCs, but it seems like he’s just trying to encourage the community to elevate their games with more personality and detail.

5 Likes

Yes, that’s the most practical way I see it working. Do you happen to know a better way of making it?

Yes it’s not “advanced” but it brings a lot of characteristic traits to your NPCs, it makes them feel more dynamic in a way

Isn’t this just Dynamic Heads, but using decals instead?

2 Likes

No, not really. That’s the best way to do it as i know of.

1 Like

why dont you make it into 1 script by putting all npcs into a folder? then u wouldnt need to copy the script into every new npc

1 Like

Because not all NPCs will have the same face, and if I did it your way, all the NPCs will have the same face

Very much, the only issue is that if you use a dynamic head on a R6 avatar the face will be in it’s “normal” state until you turn into R15

Simple but fun haha. Nice creation!

1 Like

make a config with it. and when u add a new npc to the blinking script it gives it the face u want

1 Like

But then you’re going to have to make a blinking decal for every NPC with a unique face decal

Nice creation but can’t you just tween the character’s FaceControl’s eye properties?

1 Like

I’m confused, this was meant for R6 rigs so they don’t have access to those things, correct me if I’m wrong

1 Like

will take more effort, but can take the face you want to some type of image software, cut out the eyes, use that as a base decal, then make an open/closed version of the eyes and switch between those

1 Like

In that case, this is a good resource.

1 Like

Unnecessarily cleaned up version of the script:
ImprovedBlink.rbxm Just the Module
ImprovedBlinkNPC.rbxm With the NPC

Changes

  1. Maid Life Cycle
  2. Collection service to reduce number of scripts (Optional)
  3. Ability to create custom settings for each NPC (fallback on defaults)
  4. Semi-Typed
  5. Modular, Instance creation using black magic
  6. Sanity checks (Light so people can do what they want)

Functions
.new creates a new “instance” or self representing the NPC. Managed with a Maid
.SetBlinking Sets the status of the blinking Loop
:SetBlinkingCollectionService Takes in all NPC’s tagged with a certain tag
:GetAllBlinkingNPCS Returns a raw table of all NPC’s that have registered or set up
:IsNPCInBlinkLoop Checks if this NPC is in a blinking loop
:SetUpNPC Sets up the NPC. Probably dont use this.

Configuration
When calling .new you can either input your own custom configuration or let it fallback on the default inside the Configuration module under the main module.

	Tag: string,
	
	NormalTexture: Texture, 
	BlinkTexture: Texture,

	LowRangeNormal: number,
	HighRangeNormal: number,

	LowRangeBlinking: number,
	HighRangeBlinking: number,
4 Likes