|
| 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 |
|
|
|
| 28 Feb 2015 09:32 PM |
| Ignore the first two lines, that's part of a comment |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 28 Feb 2015 11:03 PM |
| bump[7] This is getting out of hand |
|
|
| Report Abuse |
|
|
| |
|