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

Why does the camera glitch up after the script "Fixes" it?

Asked by
Prioxis 673 Moderation Voter
9 years ago

When a player joins the game on the mainGUI I have it set up for the camera to Rotate around a part in the Workspace... And that event is triggered by a button well theres another button thats suppose to trigger the exact opposite (making the camera go back to normal..) but when it does that the player can't rotate his camera or his camera is just stuck...

Script 1 (Rotates Camera)

NewCam.CameraType = Enum.CameraType.Scriptable
NewCam.FieldOfView = 30
NewCam.CameraSubject = target
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
GUI2:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Quad", 2)
while wait() do
    NewCam.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 0, 5)  
    angle = angle + math.rad(1)

Script 2 (Stops the Camera from Rotating)

script.Parent.MouseButton1Down:connect(function(click)
game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.Classic
camera.CameraType = "Custom"
camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
camera.FieldOfView = 70
print 'CamScript Worked!'
print(game.Players.LocalPlayer.Name..' is now being Teleported..')
GUI:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", 3)
wait(1)
GUI2:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Quad", 2)

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Well I don't see anything wrong with your script, but the problem may be originating from this line in the resetting script;

game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.Classic

You didn't change the CameraMode upon the start of the rotation, so why are you changing it now? I don't really see how this would affect your player like you explained it's doing.. but I don't see anything else that could cause this.. maybe try setting the CameraSubject before you set the CameraType to Custom in the Resetting script?

Ad

Answer this question