Hello, I have encountered an error that does not allow me to make a teleport effect, the error is that when the character is at a high altitude, the CameraSubject does not switch properly to the part.
I will be grateful for your help
["Teleport"] = function(plr,pos1,pos4)
local Char = plr.Character
local Eff = RS:WaitForChild("Effects"):WaitForChild("TpPart"):Clone()
local pos2 = pos1 + Vector3.new(0,300,0)
local pos3 = pos4 + Vector3.new(0,300,0)
local ColSeq = CheckColor(plr) -- trail color
Eff.Position = pos1
Eff.ParticleEmitter.Color = ColSeq
Eff.Parent = workspace.Other
if plr == Players.LocalPlayer then Camera.CameraSubject = Eff end
Char.HumanoidRootPart.Anchored = true
Char:MoveTo(Vector3.new(0, -50, 0))
for i=0,3,RunService.Heartbeat:Wait()do
Eff.Position = cubicBezier(i/3, pos1, pos2, pos3, pos4)
RunService.Heartbeat:Wait()
end
Char:MoveTo(pos4 + Vector3.new(0,5,0))
Char.HumanoidRootPart.Anchored = false
if plr == Players.LocalPlayer then Camera.CameraSubject = Char.Humanoid end
Eff.ParticleEmitter.Rate = 0
Debris:AddItem(Eff,2)
end,