Hello !
I’m currently making binoculars for my game. Everything work well, instead of a very important point ; The camera subject. I had to set the camera subject to a part that is in front of my binoculars, so the player don’t see binoculars in first person, but get a view on the front as I can put a gui after that.
The thing I want to do with that camera is that the camera should be fixed straight toward the part, and make the player rotate with it with the camera when you move your mouse. I don’t want to see up and down, nor right and left… I just want the camera to be fixed on this part, and make my player follow the mouse.
Here is the problem ;
As i’m sure that you don’t really see what I clearly mean, here is an example. When i’m in first person, the tool follows player rotation. So I want it like that, but with the camera set on the part on the front.
And the code ;
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")
local binocular = script.Parent.Zeiss
local Camera = workspace.Camera
local ZoomerInFOV = 40
local DefaultFov = workspace.Camera.FieldOfView
-- Animations ; --------------------------------------
local anim1 = h:LoadAnimation(script.Parent.Animations:WaitForChild("A1"))
local anim2 = h:LoadAnimation(script.Parent.Animations:WaitForChild("A2"))
local anim3 = h:LoadAnimation(script.Parent.Animations:WaitForChild("A3"))
local anim4 = h:LoadAnimation(script.Parent.Animations:WaitForChild("A4"))
local anim6 = h:LoadAnimation(script.Parent.Animations:WaitForChild("A6"))
------------------------------------------------------
local state = true
local tool = script.Parent
tool.Equipped:Connect(function()
binocular.Transparency = 1
anim6:Play()
wait(1.24)
anim6:Stop()
binocular.Transparency = 0
anim1:Play()
end)
tool.Activated:Connect(function()
if state == true then
anim1:Stop()
anim2:Play()
wait(0.18)
anim2:Stop()
anim3:Play()
Camera.FieldOfView = ZoomerInFOV
workspace.CurrentCamera.CameraSubject = script.Parent.Part
workspace.CurrentCamera.CameraType = Enum.CameraType.Track
state = false
else
anim3:Stop()
anim4:Play()
wait(0.18)
anim4:Stop()
anim1:Play()
Camera.FieldOfView = DefaultFov
state = true
end
end)
tool.Unequipped:Connect(function()
anim1:Stop()
anim2:Stop()
anim3:Stop()
anim4:Stop()
anim6:Stop()
Camera.FieldOfView = DefaultFov
end)