How to make teleport when dialogue? For example:
if there are 2 players, then one of them gets to this guy. And then teleports to this guy, and they both listening to the dialogue?
here is a script
local gui = script.Parent
local textbox = script.Parent.textbox
local textLabel = script.Parent.textbox.TextLabel
local jhotalksound = script.Parent:FindFirstChild("jhotalksound")
local playertalksound = script.Parent:FindFirstChild("playertalksound")
local plr = game.Players.LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local humanoid = chr:WaitForChild("Humanoid")
local dialogueFolder = game.Workspace:WaitForChild("dialogueFolder")
local jhoDialogue = dialogueFolder:WaitForChild("jhoDialogue"):WaitForChild("ProximityPrompt")
gui.Enabled = false
textbox.Visible = false
local function writeText(speaker, text, waitTime)
humanoid.WalkSpeed = 0
humanoid.JumpHeight = 0
gui.Enabled = true
textbox.Visible = true
textLabel.Text = text
if speaker == "player" then
if playertalksound then
playertalksound:Play()
else
warn("Player talk sound not found")
end
elseif speaker == "character" then
if jhotalksound then
jhotalksound:Play()
else
warn("Character talk sound not found")
end
else
warn("Unknown speaker: " .. speaker)
end
task.wait(waitTime)
end
local function endDialogue()
gui.Enabled = false
textbox.Visible = false
textLabel.Text = ""
humanoid.WalkSpeed = 16
humanoid.JumpHeight = 7.2
end
jhoDialogue.Triggered:Connect(function()
jhoDialogue.Enabled = false
writeText("player", "You: Where am I? What is this place?", 4)
writeText("character", "???: This… is a bad place. The rooms aren’t always what they seem.", 5)
writeText("player", "You: How do I get out of here?", 4)
writeText("character", "???: Ha… If I knew, I wouldn’t be here. I’ve been here for a long time. Sometimes doors lead to places they shouldn’t. And sometimes… it’s better not to open them at all.", 7)
writeText("player", "You: But there must be a way out?", 4)
writeText("character", "???: Maybe there is, but no one has found it.", 3)
writeText("player", "You: So, there’s no way out?", 4)
writeText("character", "???: You must understand that not everything is simple here. These aren’t just rooms; they are... trials.", 8)
writeText("player", "You: Trials? What kind of trials?", 4)
writeText("character", "???: You never know what awaits you behind the next door. Sometimes you’ll be closer to the exit than you think. Sometimes… quite the opposite.", 6)
writeText("player", "You: So, you can’t help me get out?", 4)
writeText("character", "???: I can only say this: be prepared. You’ll find your way out… if you’re lucky. But you’ll have to endure much before you see it.", 7)
endDialogue()
jhoDialogue.Enabled = true
end)