How do I teleport a player to different PlaceID after the GUI Dialog ends below. should I use RemoteEvent service?

Hi guys, I want to make a player teleport to different placeid when the dialogs were complete below but I have problems while making it. I tried to find many tutorials on YouTube and every website but it didn’t gave me the right answer. I was thinking that if RemoteEvent to the serverscript should work after the ending of the connect function script to teleport a player to different placeid or I messed up the script? [Context: this script is an ending script when the boss dies in a boss battle and it’s a local script on the StarterPlayer > StarterPlayerScripts

local Event = game.ReplicatedStorage.Events:WaitForChild("BossDefeated")
local SansTalk = game.Workspace.SansTalk -- this is used to make the dialog talk like Sans from undertale

local function typewrite(object,text,length)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
end


    game.ReplicatedStorage.Events.BossDefeated.OnClientEvent:Connect(function(player)
    	script.Parent.Parent.PlayerGui.VictoryMessage.Enabled = true
    	wait(4)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"Okay, Fine.     You defeated me!",0.05)
    	SansTalk:Stop()
    	wait(1)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"I did buy mass amounts of iPads just so that",0.01)
    	SansTalk:Stop()
    	wait(1)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"I can use these as my accounts to pretend to be my friends.",0.01)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"I did everything",0.01)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"All I wanted to do was just to be a troll.",0.01)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"The videos I made, was very childish.",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"test",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	script.Parent.Parent.PlayerGui.VictoryMessage.TextLabel.TextColor3 = Color3.new(0.101961, 0.988235, 1)
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"test2",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"You: text 3 ",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	script.Parent.Parent.PlayerGui.VictoryMessage.TextLabel.TextColor3 = Color3.new(0, 1, 0.0823529)
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"Yes, I purposely [no story spoilers].",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"Since you defeated me, I can't use my powers",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"I will come back! You will never def- *dies*",0.05)
    	SansTalk:Stop()
    	wait(2)
    	SansTalk:Play()
    	script.Parent.Parent.PlayerGui.VictoryMessage.TextLabel.TextColor3 = Color3.new(0.101961, 0.988235, 1)
    	game.Workspace.Lisagaming_YT:Destroy()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"You: YAY! Finally! the enemy is Defeated!!!",0.05)
    	SansTalk:Stop()
    	wait(2)
    	game.Lighting.ColorCorrection.Brightness = -0.1
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.2
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.3
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.4
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.5
    	script.Parent.Parent.PlayerGui.HealthGui.Enabled = false
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.6
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.7
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.8
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -0.9
    	wait(0.05)
    	game.Lighting.ColorCorrection.Brightness = -1
    	wait(2)
    	SansTalk:Play()
    	script.Parent.Parent.PlayerGui.VictoryMessage.TextLabel.TextColor3 = Color3.new(1, 0, 0.0156863)
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"the boss has died from a Boss Battle, and the state of ROBLOX was back to normal.",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"Many were happy that the enemy is gone.",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"and they lived happily ever after.",0.05)
    	SansTalk:Stop()
    	wait(1.5)
    	SansTalk:Play()
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"The End.",0.05)
    	SansTalk:Stop()
    	wait(2)
    	typewrite(script.Parent.Parent.PlayerGui.VictoryMessage:WaitForChild("TextLabel"),"   ",0.05)
-- I was thinking that this could be a location to teleport the player to different placeid.
    end)
1 Like

You don’t have to use remotes for this, you have to use TeleportService and enter the placeid for the player to teleport to at the end of the function

-- example in a local script
local teleportService = game:GetService("TeleportService")
local placeId = 82628276 -- random place id 

teleportService:Teleport(placeId, game.Players.LocalPlayer)
-- this would teleport the player to the given place id

TeleportService doesn’t work in studio, you would have to test this in-game

1 Like

Thanks! I’ve tested it on my phone and it did work!

1 Like