Hello guys. I’ve just been continuing my studies in scripting and making a game simultaneously and have a problem with BoolValue. I used the Part in which the script after using ProximityPrompt makes the BoolValue equal to true (It works) and added a script inside the NPC’s head with sound and decals. When I tested that after the Value became true another script in the head did nothing at all, not even a print in the output. It’s pretty simple code for someone, right? Well, I already have problems with it. I hope someone can help.
Let me tell you that I tried to replace Value with something else just by removing it and replacing it with “if TDoor anchor is false then” but it doesn’t work.
The code inside the NPC’s head:
local HeadPart = script.Parent
local AskSound = HeadPart.AskScene
local ClosedMouth = HeadPart.ClosedMouth
local OpenMouth = HeadPart.OpenEyes
local TDoor = game.Workspace:FindFirstChild("DoorTrigger1")
if TDoor.Value == true then
OpenMouth.Transparency = 0
ClosedMouth.Transparency = 1
AskSound:Play()
wait(0.1)
OpenMouth.Transparency = 1
ClosedMouth.Transparency = 0
wait(0.1)
OpenMouth.Transparency = 0
ClosedMouth.Transparency = 1
wait(0.1)
OpenMouth.Transparency = 1
ClosedMouth.Transparency = 0
wait(0.5)
HeadPart.TalkScript:Destroy()
end
Let me briefly explain the meaning of this code. When TDoor (Part or door in Workspace) activates the script it makes Value equal to true for a while and if it is true then the script in the NPC’s head will be activated and the script will make a sound and move its face (By replacing decals) as if speaking, creating a small trigger scene when the player using the door hears a voice.