Teleport person using something else

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)

Inside the character:
player

4 Likes

Player should be game.Players.LocalPlayer if it is a localscript.

1 Like

It’s not a local script, we used a normal script for it

1 Like

When the game starts their character is destroyed and changed to one from serverstorage where all the characters are

1 Like

Game I’m referencing Monster High (Update) - Roblox

1 Like

-- // 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)
2 Likes

I’ve tried this script with it and it seems to do nothing

2 Likes

Is there any error in the output?

2 Likes

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

2 Likes

Is the script a descendant of workspace?

2 Likes

Yes
yesss

1 Like

If anyone could help that would be good

@BrandonKardashianx
This should work, I rewrote your script.

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)