1. BrickPlanet Forum
  2. Game & Scripting Discussion
  3. Free teleportation
Free teleportation
Asulin
Level 4
Joined Jan 22nd 2023
Posts 5
Posted Feb 8th 2023 at 5:24PM
-- Made by Asulin
local Players = game:GetService("Players")

-- Function to teleport a player to a specified location
local function teleportPlayer(player, location)
player.Character.HumanoidRootPart.CFrame = location
end

-- Bind the function to a chat command
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
-- Check if the message is the teleport command
if message:lower() == "!teleport" then
-- Get the target player
local targetPlayer = Players:GetPlayerFromCharacter(player.Character)
-- Set the target player's location
teleportPlayer(targetPlayer, CFrame.new(0, 100, 0))
end
end)
end)

To use this script in your Roblox game, follow these steps:

1.Create a new script in the game's workspace.
2.Copy and paste the code into the new script.
3.Save the script.
4.Bind the script to a chat command by adding a "Chat" service and connecting the Chatted event.
5.Test the script by typing the command "!teleport" in the chat while in-game to teleport the player to the specified location.
Asulin
Level 4
Joined Jan 22nd 2023
Posts 5
Posted Feb 8th 2023 at 6:23PM
Apologies that above one is for roblox, this one is for brickplanet:

local Players = game:GetService("Players")

-- Function to teleport a player to a specified location
local function teleportPlayer(player, location)
player.Character.HumanoidRootPart.CFrame = location
end

-- Bind the function to a chat command
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
-- Check if the message is the teleport command
if message:lower() == "!teleport" then
-- Get the target player
local targetPlayer = Players:GetPlayerFromCharacter(player.Character)
-- Set the target player's location
teleportPlayer(targetPlayer, CFrame.new(0, 100, 0))
end
end)
end)

To use this script in the BrickPlanet workshop, follow these steps:

Create a new script in the workshop.
Copy and paste the code into the new script.
Save the script and publish it to your library.
Add the script to the game as a server script.
Start the game and type the command "!teleport" in the chat to teleport the player to the specified location.
PurpleSecretAgent
Level 8
Joined Nov 14th 2022
Posts 568
Posted Feb 9th 2023 at 7:19AM
Originally posted by Asulin on Feb 8th 2023 at 6:23PM
Apologies that above one is for roblox, this one is for brickplanet:

local Players = game:GetService("Players")

-- Function to teleport a player to a specified location
local function teleportPlayer(player, location)
player.Character.HumanoidRootPart.CFrame = location
end

-- Bind the function to a chat command
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
-- Check if the message is the teleport command
if message:lower() == "!teleport" then
-- Get the target player
local targetPlayer = Players:GetPlayerFromCharacter(player.Character)
-- Set the target player's location
teleportPlayer(targetPlayer, CFrame.new(0, 100, 0))
end
end)
end)

To use this script in the BrickPlanet workshop, follow these steps:

Create a new script in the workshop.
Copy and paste the code into the new script.
Save the script and publish it to your library.
Add the script to the game as a server script.
Start the game and type the command "!teleport" in the chat to teleport the player to the specified location.
Very useful, thanks for sharing.

Search Forum

Thread Info

Replies
2
Views
29
Created Feb 8th 2023
Last Reply Feb 9th 2023