Ad
Log in to vote
0

I'm wondering why the left and camera movement for my fnaf game doesn't work, any help?

Asked by 18 days ago

heres the script:

``local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local part = workspace.CameraPart
local character = player.Character or player.CharacterAdded:Wait()
local camera = game.Workspace.CurrentCamera
local checking = true
local position = false
local position2 = false
local tweenservice = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In,1,false,1)
local properties = {Orientation = Vector3.new(0,-77,0)}
local properties2 = {Orientation = Vector3.new(0,-89,0)}
local properties3 = {Orientation = Vector3.new(0,-103,0)}
local tween2 = tweenservice:Create(part,tweeninfo,properties)
local tween3 = tweenservice:Create(part,tweeninfo,properties2)
local tween4 = tweenservice:Create(part,tweeninfo,properties3)




print(mouse.X)
repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable

until camera.CameraType


script.Parent.ScreenGui.camgoleft.MouseEnter:Connect(function()
    if position == false then

        print("hi")

        tween2:Play()
        position = true
        camera.CFrame = part.CFrame
    end

end)

script.Parent.ScreenGui.camgomiddlefromleft.MouseEnter:Connect(function()
    if position == true then
        print("hi")
        tween2:Play()
        position = false
        camera.CFrame = part.CFrame
    end

end)``



script.Parent.ScreenGui.camgoright.MouseEnter:Connect(function()
    if position2 == false then
        print("hi")
        tween3:Play()
        position2 = true
        camera.CFrame = part.CFrame
    end

end)

script.Parent.ScreenGui.camgomiddlefromright.MouseEnter:Connect(function()
    if position2 == true then
        tween4:Play()

        position2 = false
        camera.CFrame = part.CFrame
end``

im trying to make that cool left and right camera movement in he fnaf 1 office but it doesnt work, help me pls.

1 answer

Log in to vote
0
Answered by 17 days ago
Edited 17 days ago

try to set and its also better to set the Cframe instead of Orientation as you have more control and lastly the rotations are applied in Y, X, Z order.

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable

until camera.CameraType

to

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable

until camera.CameraType == Enum.CameraType.Scriptable

this will ensure it will change to scriptable until it is scriptable

Ad

Answer this question