Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.