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

why is the localplayer's camera not able to change properties?

the script pretty much says it all, if you right click, either zoom in or out. it's not working for some reason

mouse.Button2Down:Connect(function()
if aiming == false then
	aiming = true
	workspace.CurrentCamera.FieldOfView = 40
end
if aiming == true then
	aiming = false
	workspace.CurrentCamera.FieldOfView = 70
end
end)

1 comment

0

no errors

1 answer

✓ Accepted answer

Hello, wookey12!

your scipt was setting the variable 'aiming' to true, tests it and sets it to false, so you have to use a elseif!

Working script:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local aiming = false
mouse.Button2Down:Connect(function()
	if aiming == false then
		aiming = true
		game.Workspace.CurrentCamera.FieldOfView = 40
	elseif aiming == true then
		aiming = false
		game.Workspace.CurrentCamera.FieldOfView = 70
	end
end)

Good Luck with your games!

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