My teleportation script sometimes doesn't work

I am trying to make a desk for my game. The staff working at the desk has a button that can teleport new players if they are sitting in the chair across from them. Sadly this doesn’t work for some players, and I can’t figure out why. I’ve tried replicating the error in Roblox Studios to no avail. When the error occurs the player is made to stand up yet doesn’t teleport to the desired location. Here is the code the button uses.

local debounce = false
local button = script.Parent

button.ClickDetector.MouseClick:Connect(function(player)
	if  debounce == false and player:GetRankInGroup(32519780) > 1 and script.Parent.Parent.Parent.RecruitSeat.Seat.Occupant ~= nil then
		script.Parent.Color = Color3.new(0, 0, 0)
		debounce = true
		local hum = script.Parent.Parent.Parent.RecruitSeat.Seat.Occupant.Parent
		if hum then
			print("Teleporting")
			hum.Humanoid.Sit = false
			local Pos = game.Workspace.SecurityTeleport --Gets the Part to teleport to.
			wait(.1)
			hum:SetPrimaryPartCFrame(CFrame.new(game.Workspace["SecurityTeleport"].Position))
		end
		wait(5)
		script.Parent.Color = Color3.new(0, 1, 0)
		debounce = false
	end
end)

@imacutesealy
Instead of
hum:SetPrimaryPartCFrame(CFrame.new(game.Workspace["SecurityTeleport"].Position))
why don’t you try
character:MoveTo(game.Workspace["SecurityTeleport"].Position)

(you’ll have to get character somehow, also never use CFrame in tp script in my personal experience it always sucked)

I have code that uses setprimarypartcframe for teleportation doors and they’ve always worked, however I will try implementing this solution. If this is the reason for the error I suspect it’s because the teleportation doors can attempt to teleport many times since the script runs whenever they touch the part, however, if the first time fails for these seats it doesn’t attempt to teleport again.

Did you find a solution? I have the same problem and it’s a major problem since it’s part of the main gameplay.