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 » Scripting Helpers
Home Search
 

Re: Why is this not working?

Previous Thread :: Next Thread 
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
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
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
06 Sep 2014 11:31 AM
Bump
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
06 Sep 2014 11:34 AM
define mouse

local mouse = player:GetMouse()
Report Abuse
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
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
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
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
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
06 Sep 2014 11:41 AM
Bump
Report Abuse
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
06 Sep 2014 11:47 AM
Anyone? Anyone at all?
Report Abuse
Lentzified is online. Lentzified
Joined: 06 Dec 2009
Total Posts: 138
06 Sep 2014 11:48 AM
Bump
Report Abuse
tardysauce is not online. tardysauce
Joined: 05 May 2012
Total Posts: 8444
06 Sep 2014 11:49 AM
mouse is not a preset variable.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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