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!
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
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
-- 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 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.
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
Collection service to reduce number of scripts (Optional)
Ability to create custom settings for each NPC (fallback on defaults)
Semi-Typed
Modular, Instance creation using black magic
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.