Camera Goes Back To Old Character's Position After Teleport

So i recently turned on ‘StreamingEnabled’ for my game in the making for better perfomance (map is heavy to run) and i did notice an improvement once the "AI’’ Mode is selected but when its the pvp mode selected the camera breaks once the character gets teleported from the non-killer players to the ‘killer position’ and once the small cutscene ends the killer player’s camera is set to the old player’s location and it doesnt move

Here Is The Video:

External Media

Code Used To Teleport Killer:

local teddymodelcf = teddymodel.HumanoidRootPart.CFrame
local teddymodelposition = teddymodel.HumanoidRootPart.Position
local oldCharacter = teddyplayer.Character
local val = teddyplayer.KillerChosen.Value
local char = game:GetService('ServerStorage').killers:WaitForChild(val)
local newCharacter = char:Clone()
teddyplayer:RequestStreamAroundAsync(teddymodelposition)
wait(2)
newCharacter.HumanoidRootPart.CFrame = teddymodelcf
 oldCharacter:Destroy()
newCharacter.HumanoidRootPart.Anchored = false
teddyplayer.Character = newCharacter

Script Used For The Camera Cutscene:

local camera = workspace.CurrentCamera
local campart = workspace:FindFirstChild('tedcam', true)
camtrue = true
game:GetService('RunService').RenderStepped:Connect(function()
	if camtrue == true then
		camera.CFrame = campart.CFrame
	end
end)
wait(3)
camtrue = false
repeat 
	camera.CameraType = Enum.CameraType.Custom
until camera.CameraType == Enum.CameraType.Custom

i Would Also Like To Mention Before I Enabled ‘StreamingEnabled’ The system worked perfectly fine

can someone explain what is happening in my case? thanks!

1 Like

after going to sleep i fixed it the problem was that the camera’s subject wansnt attaching to the new character’s humanoid so a simple line of code fixed it

camera.CameraSubject = game:GetService('Players').LocalPlayer.Character:FindFirstChild('Humanoid')

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.