So I’m trying to get a script to teleport someone but their character changes so it doesn’t teleport them anymore.
Script:
local TeleportService = game:GetService(“TeleportService”)
local Door = script.Parent.Door
local Id = 15079739707
Door.Touched:Connect(function(touch)
local Player = game.Workspace.player.Humanoid(touch.Parent)
if Player then
script.Teleportscreen:Clone().Parent = Player.PlayerGui
TeleportService:Teleport(Id, Player)
end
end)
-- // Services
local TeleportService = game:GetService("TeleportService")
local PlayersService = game:GetService("Players")
local Id = 15079739707
local Door = script.Parent.Door
local TeleportingPlayers = {}
local DBTime = 1 -- Debounce for touched event
local DB = false
Door.Touched:Connect(function(touch)
if DB then return end
DB = true
task.delay(DBTime, function()
DB = false
end)
local model = touch:FindFirstAncestorOfClass("Model")
local Player
if model then
Player = PlayersService:GetPlayerFromCharacter(model)
end
if Player then
if table.find(TeleportingPlayers, Player) then return end -- Player is already teleporting
table.insert(TeleportingPlayers, Player)
script.Teleportscreen:Clone().Parent = Player.PlayerGui
TeleportService:Teleport(Id, Player)
end
end)
TeleportService.TeleportInitFailed:Connect(function(player, result)
if result ~= Enum.TeleportResult.IsTeleporting then
table.remove(TeleportingPlayers, table.find(TeleportingPlayers, player))
end
end)
No error is shown for it either so I don’t think it notices its getting touched, the characters are skinned meshes so maybe thats why because it only works when a normal r6 or r15 touches it
local TeleportService = game:GetService("TeleportService")
local Door = script.Parent.Door
local Id = 15079739707
Door.Touched:Connect(function(touch)
local Character = touch.Parent
local Player = nil
if Character:IsA("Model") then
if Character:WaitForChild("Humanoid", 5) then
Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
end
end
if Player then
script.Teleportscreen:Clone().Parent = Player.PlayerGui
TeleportService:Teleport(Id, Player)
end
end)