Hey, So I made a portal script and sometimes when the player touches the teleport part it doesn't teleport them to the designated area.
Heres my script:
--[ Variables ]-- local Portals = game:GetService("Workspace").PortalArea.Portals --[ Main ]-- function disconnectFunction(connection) if connection then connection:disconnect() end end while wait() do for i,v in pairs(Portals:GetChildren()) do connection = v.TouchPart.Touched:Connect(function(Hit) if game.Players:FindFirstChild(Hit.Parent.Name) then local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid") if Humanoid.Health > 0 then local Character = Humanoid.Parent local HumanoidRootPart = Character.HumanoidRootPart local Destination = v:FindFirstChild("Destination").Value local TeleportTo = Portals[tostring(Destination)].TeleportPart.CFrame HumanoidRootPart.CFrame = TeleportTo end end end) wait(.1) disconnectFunction(connection) end end