Was testing random stuff but ran into a problem

I want to rotate the camera view idk how tho

local script:

local uis = game:GetService("UserInputService")

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait(0.1)
local humrp = char:WaitForChild("HumanoidRootPart")
local cam = workspace.CurrentCamera
uis.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end
	if	input.KeyCode ==  Enum.KeyCode.B then
		cam.CameraType = "Scriptable"	
		while wait(1) do
			cam.CFrame =   humrp.CFrame * CFrame.new(0,5,0) * CFrame.fromEulerAnglesXYZ(0,10,0)
			end
	end
end)

its in starter pack fyi
and when the camera goes to the humrp it looks like im teleporting

That’s because you’re using wait (1) as the condition in the while loop. You’re also not breaking the loop when a new function is called via the connection, which will create performance issues.

I hope this solves your issue!

1 Like