So my script makes the players camera.CFrame to another part.CFrame. I've never had this problem before, but all a sudden, if there is a part overlapping or close to the part.CFrame which the camera goes to, the Camera flies forward, the Enum of said camera is scriptable but why does it do this? To make it more confusing, it only does this if any overlapping part or close part is CanCollide = true and the camera flying forward depends on the size of said part. Does anyone else have this glitch or is it a scripting thing that I have to deal with?

the code:

local Plr = game.Players.LocalPlayer
local plrGui = Plr:WaitForChild("PlayerGui")
plrGui:WaitForChild("Main")

-------------------Variables
local chosenRoomPos = 1
plrGui.Main.EditHotel.MouseButton1Click:Connect(function()
	if Plr.Hotel.Value ~= nil then
		local Cam = game.Workspace.CurrentCamera
		Cam.CameraType = Enum.CameraType.Scriptable
		local Hotel = Plr.Hotel.Value
		local chosenConnector = Hotel.AllConnectors[chosenRoomPos]
		local chosenFrame = Hotel.AllConnectors[chosenRoomPos]
		Cam.CFrame = chosenConnector.CFrame * CFrame.new(0,6.5,25)
		workspace.SelectionBox.Adornee = chosenFrame
	end
end)

6 comments

1

Nice glitch, we would like the code though

0

it is literally game.Workspace.CurrentCamera.CFrame = workspace.Part.CFrame

1

Did you know, that should work 100% fine..? It is about the lerp

1

Supply us with the code please, the entire code!

0

Wait, i've heard of lerp before but never used it or understood it

0

camera.CFrame = camera.CFrame:lerp(Position,2) something like that