Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make an NPC that changes its face when a dialog choice is selected?

I want my NPC to change faces according to which dialog choice a player selects. I started this script, but it does nothing. I don't know what's wrong. Help?

npcface = game.Workspace.WearyTraveler.Christopher.Head.face

game.Workspace.WearyTraveler.Christopher.Head.DialogChoiceSelected:connect(function(player,choice)
	if choice.Name == "DialogOne" then
		npcface.Transparency = 1
	end
end)

(Also, if there's a way to "disable" the face without making it transparent, that'd be great ;) )

1 answer

Another thing, I've been putting the script inside of the Dialog, does that mess up anything?

Could I put multiple faces in the Head and set the Transparency on each on to 0? Then, with the script...

joyface = game.Workspace.WearyTraveler.Christopher.Head.joyface --Transparency is 1
sadface = game.Workspace.WearyTraveler.Christopher.Head.sadface --Transparency is 1
chris = game.Workspace.WearyTraveler.Christopher

chris.Head.DialogChoiceSelected:connect(function(player,choice)
    if choice.Name == "DialogOne" then
        joyface.Transparency = 0
    if choice.Name == "DialogTwo" then
	joyface.Transparency = 1
        sadface.Transparency = 0
    end
end) --Do I have enough ends?

And so on

I know this script is crude, but I'm a novice scripter, and it's all I can understand. xD

This discussion is preserved as it was. New answers, comments, and votes are closed.