|
| 06 Sep 2014 11:21 AM |
I have a script for a sniper rifle that when you press 'z', it zooms in and makes a GUI in your PlayerGui called SniperLense appear and dissapear according to whether or not the value IsZoomed inside the tool is true or false. Here's the script:
local character = script.Parent.Parent local tool = script.Parent local player = game.Players:GetPlayerFromCharacter(character) tool.Equipped:connect(function(mouse) mouse.KeyDown:connect(function(key) if key == "z" then if script.Parent.IsZoomed.Value == true then game.Workspace.Camera.FieldOfView = 70 player.PlayerGui.SniperLense.ImageLabel.Visible = false script.Parent.IsZoomed.Value = false elseif script.Parent.IsZoomed.Value == false then game.Workspace.Camera.FieldOfView = 5 player.PlayerGui.SniperLense.ImageLabel.Visible = true script.Parent.IsZoomed.Value = true end end end) end)
I can't figure out why it won't work. Any help? |
|
|
| Report Abuse |
|
|
| |
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 06 Sep 2014 11:34 AM |
define mouse
local mouse = player:GetMouse() |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2014 11:37 AM |
| I don't think that's the problem. The GUI is giving me the problem, not defining mouse. It was working fine with just the field of view edits. I'll try, though. |
|
|
| Report Abuse |
|
|
|
| 06 Sep 2014 11:39 AM |
Nope. It still gives me this error:
Players.Player1.Backpack.LR12.Zoom:13: attempt to index upvalue 'player' (a nil value) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 06 Sep 2014 11:49 AM |
| mouse is not a preset variable. |
|
|
| Report Abuse |
|
|