Fun Value

The fun value is a random number in Undertale, selected on Reset, between 1 and 100. This mechanic determines the occurrence of several rare events in the game; many of these events link to W. D. Gaster, the royal scientist before Alphys. These can range from Cell Phone calls, slight visual differences, or NPCs or locations appearing.
== Events ==
Fun Value	Event 	Chance	Notes
2–39 	Wrong Number Song	38% 	
40–45 	Sans's Call 	6% 	
46–50 	Alphys's Call 	5% 	
56–57 	Nightmare Mode 	2% 	
61 	Gaster Follower 2	0.2% 	20% chance if the fun value is right.
62 	Gaster Follower 1	0.5% 	50% chance to appear if the fun value is right.
63 	Gaster Follower 3	0.5% 	50% chance to appear if the fun value is right.
65 	Sound Test Room 	0.5% 	After the protagonist defeats Papyrus, it has 50% chance to appear if the fun value is right.
66 	Fake Hallway 	1% 	
66 	Mystery Man Room 	0.1% 	10% chance to appear if fake hallway is found.
80–89 	Clam Girl 	10% 	Does not occur during the Genocide Route.
81 	Goner Clam Girl 	1% 	Only on the Nintendo Switch and Xbox version. Does not occur during the Genocide Route.
90–100 	Goner Kid 	11% 	
=== Wrong Number Song ===
This song plays in Snowdin, in the River Person room, if the fun value is within the range 2 to 39. The phone call begins asking for somebody whose name starts with the letter "G." The caller then recognizes that they dialed the wrong number, and proceeds to sing the Wrong Number Song, which has similar soundfont to Wrong Enemy !?. This phone call is speculated to be for Gerson, Glyde, Gyftrot, Grillby, or W. D. Gaster. Even in the Japanese localization, the initial greeting is in English so as to give no further hints to what character it could be.
There is a known glitch with the Wrong Number Song where the avatar of whomever the protagonist spoke to last shows up as the ID of the call. This glitch was patched in version 1.001.
=== Sans's Call ===
This occurs when the fun value is between 40 and 45. Sans calls the protagonist in Snowdin Forest, near Papyrus's cardboard sentry station. He asks if their refrigerator is running, and his response varies depending on what answer is chosen; if it is, he offers to "deposit the brewskis," and if not, to "send someone over to fix it."
=== Alphys's Call ===
This occurs when the fun value is between 46 and 50. It is an alternate phone call than can occur in Snowdin Forest, near Papyrus's cardboard sentry station. Alphys calls the protagonist ostensibly to order a pizza. She says that she texts the protagonist the toppings but instead ends up sending ASCII art of an anime cat girl (possibly Mew Mew). The protagonist's old phone cannot receive this, so it is read out character by character.
=== Nightmare Mode ===
This occurs when the fun value is between 56 and 57. On the Monster Kidz Word Search in Snowdin Forest, the puzzle additionally contains a bear-faced snowman called "Nightmare."
=== Gaster Followers ===
Three monsters may appear near Hotland elevators if the fun value is between 61 and 63 (one for each value). However, two of them only have a 50% chance of appearing and the one resembling Scared Donut Guy has only a 20% chance. They talk about W. D. Gaster, the royal scientist before Alphys, and his fate.
The least likely one to appear speaks in rhymes, and disappears while snd_mysterygo plays after admitting to the protagonist it is holding a piece of W. D. Gaster. The other two stay around after they finish talking, but reset the fun value to 0 on appearance, so they do not reappear when re-entering their respective rooms.
=== Sound Test Room ===
By traveling upwards from the "Box Road" SAVE Point intersection in Snowdin Forest, if the fun value is set to 65 and Papyrus has been defeated, there is an additional 50% chance for a hidden "sound test" room to appear. The menu itself contains three very short looping tracks and a longer track that, once picked, cannot be deselected. None of these tracks are used anywhere else in the game.
==== Happy Town ====
A short, cheery jingle with the filename "mus_st_happytown".
==== Meat Factory ====
A short robotic track with the filename "mus_st_meatfactory".
==== Trouble Dingle ====
A short series of seemingly random robotic noises with the filename "mus_st_troubledingle".
==== Gaster's Theme ====
Upon selecting this track, no other songs can be selected. After listening to Gaster's Theme for a period, the room ceases playing music and displays a screen that says "Thanks for your feedback! Be seeing you soon!". The protagonist is then returned to the room with the fishing pole. The file is titled "mus_st_him".
=== Fake Hallway ===
The fake hallway is a hallway in Waterfall that appears if the fun value is 66. It can appear between the "Crystal" SAVE Point and the Sans's telescope rooms. Once the protagonist enters this hallway the fun value is set to 0, including in the persistent undertale.ini file, so they cannot enter it again.
There is an additional 10% chance for the Mystery Man to appear behind a grey door in this hallway. Once interacted with, he fades away to snd_mysterygo, which shares the same starting notes as Gaster's Theme with heavy delay applied. The room is called room_mysteryman.
=== Clam Girl ===
Clam Girl appears at the "Quiet Area" SAVE Point if the fun value is between 80 and 89 and the protagonist is not on the Genocide Route. She talks about the protagonist meeting "Suzy". If the fun value is exactly 81 on the Nintendo Switch and Xbox version, she becomes a Goner NPC with additional dialogue.
=== Goner Kid ===
A gray version of Monster Kid (spr_mkid_goner) can appear in Room 91 (room_water7) on a dock right before the room where Undyne first throws spears at the protagonist if the fun value is 90 or greater.
This character has additional dialogue if brought an umbrella, which can be found in the room after the statue that is being rained on. After exhausting the new dialogue with the umbrella and leaving the room, Goner Kid no longer appears.
== Modification ==
The fun value can be modified using a text editor on line 36 of file0 and the "[General]" header of the undertale.ini file. These files are stored at the following locations by default:
* Windows:
** Windows XP: %SystemDrive%/Documents and Settings/%USERNAME%/Local/Application Data/UNDERTALE
** Windows Vista and later: %LOCALAPPDATA%/UNDERTALE
* Linux:
** DRM-free: ~/.config/UNDERTALE_linux
** Steam: ~/.config/UNDERTALE_linux_steamver
** Steam (later versions): ~/.config/UNDERTALE
* Mac: ~/Library/Application Support/com.tobyfox.undertale/
The presence of fun events is dictated primarily by line 36 of file0, internally referred to as global.flag[5]. Several of the events additionally require the named value in undertale.ini to match that of global.flag[5].
== Trivia ==
* Several fun events are triggered regardless of the fun value if debug mode is enabled through game modification.
* Before v1.001, the fun value was capitalized as "Fun value" in several code checks and thus made those events (Nightmare Mode, Gaster Followers, the Sound Test room, the fake hallway, and Goner Kid) inaccessible.
== References ==
pt-br:Fun Value
ru:Значение fun
zh:fun值