|
| 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 |
|
|
|
| 31 May 2012 04:28 PM |
Well, which line is it coming from?
-orangegreenblue, the Lua Noob |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 31 May 2012 04:30 PM |
Here's the output line: - attempt to call a nil value That's it
|
|
|
| Report Abuse |
|
|
|
| 31 May 2012 04:34 PM |
| LOL, nevermind! I found the problem! I miss-spelled Equip! I put 2 p's. :) |
|
|
| Report Abuse |
|
|