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

What is making my dialogchoice not doing anything when you click on it?

I am making an NPC that teleports you to a place through a dialog, but the dialog option is not doing anything. Help would be appreciated.

local teleport = game:GetService("TeleportService")

script.Parent.DialogChoiceSelected:Connect(function(player,dialog)
if dialog.Name == "choice1" then
print("print")
local id = -- game id -- 
wait(3)
teleport:Teleport(id, player)
print("teleported")
end
end)

It doesn't even print "print"

2 comments

0

Dialogs and teleportation services don’t work in studio

0

even outside of studio it doesn't work

1 answer

✓ Accepted answer

Issues

Make sure to use a LocalScript in order to interact with the Dialog, as otherwise the function will not work. The LocalScript should also be within a Client specific area, like the StarterGui and not within a Part in the Workspace,

Revised Local Script under StarterGui

local teleport = game:GetService("TeleportService")
local dlog = workspace:WaitForChild("DPart"):WaitForChild("Dialog")

dlog.DialogChoiceSelected:Connect(function(player, dialog)
    if dialog.Name == "choice1" then
	    print("print")
	    local id = 0
	    wait(3)
	    teleport:Teleport(id, player)
	    print("teleported")
    end
end)

In the above example, the part which holds the dialog is a part named "DPart" in the Workspace with the Dialog parented under it

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