Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix the frustrating camera glitch?

Asked by 5 years ago
Edited 5 years ago

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)
1
Nice glitch, we would like the code though greatneil80 2647 — 5y
0
it is literally game.Workspace.CurrentCamera.CFrame = workspace.Part.CFrame Marmalados 193 — 5y
1
Did you know, that should work 100% fine..? It is about the lerp greatneil80 2647 — 5y
1
Supply us with the code please, the entire code! Synth_o 136 — 5y
View all comments (2 more)
0
Wait, i've heard of lerp before but never used it or understood it Marmalados 193 — 5y
0
camera.CFrame = camera.CFrame:lerp(Position,2) something like that greatneil80 2647 — 5y

Answer this question