- What do you want to achieve?
I want to make it so that when the part that is touched (otherPart) it will teleport me to another server of my game that is part of my previous game in the game explorer. However, when I log the game on actual Roblox, not studio, the teleportation simply doesn’t work and I’m not sure why.
- What is the issue?
Teleportation isn’t working correctly, I have no idea where the issue lies. The script that is below is placed in a local script with the parent being the part that is being touched, this is anchored and is not touching anything such as the floor.
Local script code
local TeleportService = game:GetService("TeleportService")
local typeServer = 4767149057
local function onPartTouch(otherPart)
local player = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if player then
TeleportService:Teleport(typeServer, player)
end
end
script.Parent.Touched:Connect(onPartTouch)
(This has been done in a server script)