generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Gun Zoom Script Error

Previous Thread :: Next Thread 
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 09:31 PM
I am making a zoom for a Gun Script that detects if the player has the gun equipped through a BoolValue and then detects the FOV of the camera and zooms the camera so the person can see farther with the gun. I achieve the Zoom In, but it does not want to zoom out. And whenever I unequip the gun, it cuts out the script entirely and the zoom does nothing. How can I make this complete the zoom cycle and make it not break when unequipped?

here is what I have so far in my gun script:

--[[mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
mouse.Icon = "rbxasset://textures\\GunCursor.png"]]
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local Gun = script.Parent
local Muzzle = Gun.Muzzle
local Handle = Gun.Handle
local cam = workspace.CurrentCamera
script.Parent.Equipped:connect(function()
plr.CameraMode = "LockFirstPerson"
mouse.Icon = "rbxasset://textures\\GunCursor.png"
Gun.EquippedVal.Value = true
end)
script.Parent.Unequipped:connect(function()
plr.CameraMode = "Classic"
mouse.Icon = ""
local cam = workspace.CurrentCamera
cam.FieldOfView = 70
Gun.EquippedVal.Value = false
cam.Changed:connect(function()
cam.FieldOfView = 70
end)
end)
local dbval = true
mouse.Button2Down:connect(function()
if dbval == true then dbval = false
if Gun.EquippedVal.Value == true then
if cam.FieldOfView == 70 then
for i = 1,45 do
cam.FieldOfView = cam.FieldOfView - 1
wait()
end
elseif cam.FieldOfView == 25 then
for i = 1,45 do
cam.FieldOfView = cam.FieldOfView + 1
wait()
end
end
end
dbval = true
end
end)

Please Help soon! Thanks!
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 09:32 PM
Ignore the first two lines, that's part of a comment
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 09:33 PM
Okay, I fixed the Unequip Breaking by removing the cam.Changed event, but I still need help with the zoomout :/
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 09:46 PM
bump
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 10:11 PM
bump[2]
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 10:18 PM
bump[3]
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 10:33 PM
bump[4]
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 10:45 PM
bump[5] Sheesh!
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 10:56 PM
bump[6] srsly guise
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 11:03 PM
bump[7] This is getting out of hand
Report Abuse
FOXmcloud021 is not online. FOXmcloud021
Joined: 14 Apr 2012
Total Posts: 3512
28 Feb 2015 11:13 PM
bump[8] -__-
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image