Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to teleport to places after finished talking to NPC?

Asked by 10 years ago

So I'm making a game, and inside it after you are done talking to someone (with dialog) 5 seconds after talking it will teleport them to a different game. Could anyone try to give me a script for it?

0
Do you have your Dialog script made? If so, post it here. Shawnyg 4330 — 10y

1 answer

Log in to vote
1
Answered by
TofuBytes 500 Moderation Voter
10 years ago

Tested this out and it will work! This script should go into ServerScriptService or Workspace.

local guy = game.Workspace:WaitForChild("Person Name") --Works with humanoids with the name.
local dialog = guy:WaitForChild("Head"):WaitForChild("Dialog")
local id = --Place ID

dialog.DialogChoiceSelected:connect(function (player,selection)
    wait(1)
    if selection.Name == "Dialog Name" then --This checks for if the player clicks the DialogChoice named "Dialog Name"
        game:GetService("TeleportService"):Teleport(id)
        dialog.Parent = nil
    else
        --Other Dialog that is not that option. (optional)
    end
end)
Ad

Answer this question