So I have this script:
local teleportService = game:GetService("TeleportService")
local players = game:GetService("Players")
script.Parent.Touched:Connect(function(part)
if part.Name ~= "HumanoidRootPart" then return end
local player = players:GetPlayerFromCharacter(part.Parent)
if player == nil then return end
local success, message = pcall(teleportService:TeleportAsync(16004814573, {player}))
if success == false then print("False") return end
game.ReplicatedStorage.Teleporting:FireClient(player)
end)
I have a touching part that teleports me when touched. Whenever I touch it wraps the response in a pcall. For some reason it returns false indicating that I won’t be teleported. However after around 4 seconds I do get teleported. You can see that I have a remote event that must be fired right after the pcall but it WON’T be fired because of that if statement that checks the response from the pcall. Appreciating any possible solution.