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

How to make a auto telerporter?

when the server begins they need to wait 30 Sec than they will tp there. And they need to wait 150 Sec and they will tp back. And then they need wait again 30 Sec. I hope u guys can help.

Ps: if u don't understand contact me on roblox (PreviousMonster) Follow me to Msg me (This is to prevent spammers)

1 comment

0

i wz gonna ask

1 answer

PartToTpTo = workspace.Part -- Specify Path to the Object

while true do
	wait(30)
	for integer, player in next, game:GetService("Players"):GetPlayers() do
		local backPosition = player.Character:GetPrimaryPartCFrame()
		player.Character:MoveTo(PartToTpTo.Position)
		delay(150, function()
			player.Character:MoveTo(backPosition)
		end
	end
	wait(150)
end

Explanation:

Use the while keyword to loop until an error or the break keyword appears. Use the for keyword to loop once. When you've got all the players in the for-loop: Assign a local variable to capture their current position to use it later so you can teleport them back. Use the MoveTo method to move the character model to a position. In this case, we use the part's position. Use the delay function to make it yield (wait) an amount of seconds and then fire another function without making the script yield (wait). Use another wait function to delay the next loop's start and so that you wait for the players to teleport back. In the next start, after the players have teleported back, it will wait 30 seconds again and redo the whole thing again.

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