I am fairly new to scripting and I am making a game sort of like the Stanley parable. I don't know how to make a narrator speak at certain trigger points like the opening of a door or moving to a certain place. Can somebody help?
How would I go about with a narrator for my game?
1 answer
Since it sounds like you are going to use audio recordings, I'll show you that way.
First, you could try to run a loop to see how far the player is away from something.
local played = false
while true do
wait()
if played == false then
local dist = player:DistanceFromCharacter(game.Workspace.Part.Position) --Replace player with however you can access the player. Replace game.Workspace.Part to the path of a part within the area where you want the sound to play or a vector3.
if dist <= 10 then --replace 10 to the distance you want between the player and the part until the sound is played
played = true
game.Workspace.sound:Play() --Replace to path to sound.
end
else
break
end
end
Second, you could try to make it trigger when you touch an object, such as a door.
local touched = false
game.Workspace.Part.Touched:Connect(function(plrpart)
if touched == false then
if plrpart.Parent:FindFirstChild("Humanoid") then
touched = true
local plr = game.Players:GetPlayerFromCharacter(plrpart.Parent) --this is just if you want to be able to access the player.
game.Workspace.sound:Play() --Replace to path to sound.
end
end
end)
Third you could do it when something is clicked, assuming you have a click detector.
local clickdet = game.Workspace.Part.ClickDetector --Replace to path to click detector
local clicked = false
clickdet.MouseClick:Connect(function(plr)
--plr is to access the player who clicked if you need to
if clicked == false then
clicked = true
game.Workspace.sound:Play() --Replace to path to sound
end
end)
This all assuming your game is single player, since Stanley Parable is single player. (at least I think so) If not, a few changes will have to be made to the scripts so they can run again but not by the same player and can only be heard by one player. (unless you plan on all the players triggering the stuff together) That is when the whole entire narrator system would have to be run from a localscript I believe. (along with making sure the players triggering it are your localplayer)
Hope this helped.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Two ways: 1. text labels that tell the user what's going on 2. Manually narrate the game, recording a voice, upload each narration to roblox spend some row bucks and then stuff
If you want to make a vocal narration system, I would suggest using audio recordings.