exp_lol123
(Unavailable)
June 26, 2021, 12:47pm
#1
Let’s get straight into it, so I’ve been trying to make an FOV system recently but nothing has been working.
This is my script:
workspace.Camera.CameraType = Enum.CameraType.Scriptable
workspace.Camera.FieldOfView = script.Parent.Text
By the way the Gui is a textbox.
I’ve also tried doing it with a button:
workspace.Camera.CameraType = Enum.CameraType.Scriptable
script.Parent.MouseButton1Click:Connect(function()
workspace.Camera.FieldOfView = 60
end)
But that also didn’t work. If you have any ideas please tell me!
1 Like
Ryl0P
(Ryl0P)
June 26, 2021, 12:50pm
#2
you need to use workspace.CurrentCamera
not workspace.Camera
this is the problem
exp_lol123
(Unavailable)
June 26, 2021, 12:52pm
#3
I’ve just tried that but it isn’t changing anything. Here’s the script:
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.FieldOfView = script.Parent.Text
Enomphia
(Enomphia)
June 26, 2021, 12:53pm
#4
Give this a try and let me know if it works.
(You don’t need to change the CameraType to set the FieldOfView.)
workspace.CurrentCamera.FieldOfView = tonumber(script.Parent.Text)
exp_lol123
(Unavailable)
June 26, 2021, 12:56pm
#5
It still doesn’t work. It prints 70 and I see no changes to my camera. By the way I’ve added an extra line for checking what FOV the camera is on. This is the line:
print(workspace.CurrentCamera.FieldOfView)
Enomphia
(Enomphia)
June 26, 2021, 12:57pm
#6
Could you possibly show me your full script and a screenshot of where the TextBox and script is?
exp_lol123
(Unavailable)
June 26, 2021, 12:59pm
#7
I’ve mentioned the full script in my post.
The text box is here:
The script is here:
Enomphia
(Enomphia)
June 26, 2021, 12:59pm
#8
Is the script named “Detect” the one setting the FieldOfView?
Yes it’s setting the field of view
Enomphia
(Enomphia)
June 26, 2021, 1:01pm
#10
Put the code of it in a local script.
You should try this instead;
workspace.Camera.CameraType = Enum.CameraType.Scriptable
button.MouseButton1Click:Connect(function()
workspace.Camera.FieldOfView = tonumber(TextBox.Text)
end)
exp_lol123
(Unavailable)
June 26, 2021, 1:02pm
#12
I put it in a local script but it didn’t work.
Enomphia
(Enomphia)
June 26, 2021, 1:02pm
#13
Are there any errors in the output?
exp_lol123
(Unavailable)
June 26, 2021, 1:03pm
#14
Nope, there are no errors regarding the script.
exp_lol123
(Unavailable)
June 26, 2021, 1:04pm
#15
This also didn’t work unfortunately.
Enomphia
(Enomphia)
June 26, 2021, 1:04pm
#16
Put this in your script that is parented to the TextBox.
script.Parent.Changed:Connect(function()
workspace.CurrentCamera.FieldOfView = tonumber(script.Parent.Text)
end)
And make sure it is in a LocalScript.
1 Like
Yea I assume this one should work just fine.