Teleportation System Does not Work

I Have A Train System That Only Works One Way, One Time (Or Sometimes Doesnt Work At All) And I Really Dont Understand Why At All, It Is Run By Two Scripts, But They Are Identical, The Code Is Below:

script.Parent.Triggered:Connect(function(Player)
	local char = Player.Character
	local root = char:WaitForChild("HumanoidRootPart")
	local tpart = script.Parent.TPart
	local gui = script.TransitionScript:Clone()
	gui.Parent = Player.PlayerGui
	Player.Character.Humanoid.WalkSpeed = 0
	local guii = Player.PlayerGui
	Player.Character.Humanoid:UnequipTools()
	for i, v in ipairs(Player.Backpack:GetChildren()) do
		v.Parent = game.ReplicatedStorage:FindFirstChild(Player.Name)
	end
	task.wait(1)
	root.CFrame = tpart.CFrame
	task.wait(1)
	for i, v in ipairs(game.ReplicatedStorage:FindFirstChild(Player.Name):GetChildren()) do
		v.Parent = Player.Backpack
	end
	Player.Character.Humanoid.WalkSpeed = 20
end)

What are you trying to do the code you’re showing is only going to be ran if the script is triggered, and with a 1 sec delay without showing what triggers the script there’s no way to troubleshoot this

Sorry, I Wasnt Really Being Clear, The Script is A Server Script, And Its Parent Is a Proximity Prompt, And There Are Two Of Them, At The Opposite Sides Of The Map, with A Part On The Opposite Side Of The Map, Being The Child Of Each Proximity Prompt
robloxapp-20240813-1532308.wmv (1.3 MB)