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: "attempted to call a nil value" Help?

Previous Thread :: Next Thread 
boom4444444 is not online. boom4444444
Joined: 14 Nov 2009
Total Posts: 40
31 May 2012 04:24 PM
Here's the script i'm trying to make work for a gun. It's a Local Script.

------------------------------------------------------------------

--------Values--------
config=script.Parent.Config
Reloading=config.Reloading
Ammo=config.Ammo
Maxammo=config.MaxAmmo
----------------------
function RunGui(mouse)
while true do
wait(.1)
player=game.Players:FindFirstChild(script.Parent.Parnet.Name)
if player~= nil then
if player.className == "Player" then
if player.PlayerGui:FindFirstChild("AmmoGui") ~= nil then
Gui=player.PlayerGui.AmmoGui
if Reloading.Value==false then
mouse.Icon = "rbxasset://textures\\GunCursor.png"
Gui.Main.Ammo.Text="Ammo: "..Ammo.Value.."/"..Maxammo.Value
Gui.Main.Name.Text=script.Parent.Name
else
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
Gui.Main.Ammo.Text="Reloading..."
end
else
print("Umm, your missing a Gui. .preD?")
end
end
end
end
end


function Equip(mouse)
wait(.1)
local player=game.Players:FindFirstChild(script.Parent.Parnet.Name)
if player~= nil then
if player.className == "Player" then
if player.PlayerGui:FindFirstChild("AmmoGui") == nil then
script.Parent.AmmoGui:Clone().Parent=player.PlayerGui
RunGui(mouse)
end
end
end
end

function UnEquip(mouse)
wait(.1)
local player=script.Parent.Parent.Parent
if player~= nil then
if player.className=="Player" then
if player.PlayerGui:FindFirstChild("AmmoGui") ~= nil then
player.PlayerGui.AmmoGui:remove()
end
end
end
end


script.Parent.Equipped:connect(Equipp)
script.Parent.Unequipped:connect(UnEquip)

-------------------------------------------------------------------------

I went threw the whole thing. I cannot figure out what it's talking about. Is there anyway you can figure out what line the "attempted to call a nil value" is coming from? If not, please someone fix it :(
Report Abuse
orangegreenblue is not online. orangegreenblue
Joined: 04 Sep 2010
Total Posts: 10906
31 May 2012 04:28 PM
Well, which line is it coming from?

-orangegreenblue, the Lua Noob
Report Abuse
boom4444444 is not online. boom4444444
Joined: 14 Nov 2009
Total Posts: 40
31 May 2012 04:29 PM
That's the problem, it doesn't say. That's why I hate these "attempted to call a nill value" things.
Report Abuse
boom4444444 is not online. boom4444444
Joined: 14 Nov 2009
Total Posts: 40
31 May 2012 04:30 PM
Here's the output line:
- attempt to call a nil value
That's it
Report Abuse
boom4444444 is not online. boom4444444
Joined: 14 Nov 2009
Total Posts: 40
31 May 2012 04:34 PM
LOL, nevermind! I found the problem! I miss-spelled Equip! I put 2 p's. :)
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