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: Can you please help with this gun? (Really wierd output!)

Previous Thread :: Next Thread 
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
12 Sep 2010 08:49 PM
Can you help with this script? Here's the output:
attempt to call a nil value
That's all it says!! It doesn't give me a line # or anything! I think it's on lines 69, 70, 73, or 76... I wish I could give you more info, but i can't.


Tool = script.Parent
colors = {24}
local a = 0
function fire(v)
Tool.Handle.Fire:play()
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local missile = Instance.new("Part")
local spawnPos = vCharacter.PrimaryPart.Position
spawnPos = spawnPos + (v * 8)
missile.Position = spawnPos
missile.Size = Vector3.new(0.2,0.2,0.2)
missile.Velocity = v * 641
missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
missile.Shape = 0.5
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Paintball"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = 1
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,75,0)
force.Parent = missile
Tool.BrickCleanup:clone().Parent = missile
local new_script = script.Parent.Paintball:clone()
new_script.Disabled = false
new_script.Parent = missile
local mesh = Tool.Mesh:clone()
mesh.Parent = missile
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
end
function check(en)
if (Tool.Enabled == false) then
return false
end
if (Tool.Enabled == true) then
return true
end
end
Tool.Enabled = true
while a == 1 do
function onActivated()
if not Tool.Enabled then
return
end
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
if (check()) then
fire(lookAt)
wait(0.05)
onActivated()
end
return
end
end
script.Parent.Activated:connect(onActivated)
function Equip(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end) --could be here
mouse.Button1Up:connect(function() nofiar(mouse) end) --or here
end
Tool.Equipped:connect(Equip)
function onButton1Down(mouse) --or here
a = 1
end
function nofair(mouse)
a = 0 --or here...
end
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
12 Sep 2010 09:01 PM
Bump
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 07:06 AM
Bump!
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
13 Sep 2010 09:44 AM
Well, there is a nil value somewhere in the script. That is, you are trying to call something which doesn't exist.
Report Abuse
nominate10 is not online. nominate10
Joined: 20 May 2008
Total Posts: 2545
13 Sep 2010 10:04 AM
You tried calling the function 'nofiar' before you defined it.
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 04:47 PM
... Okay... How do I fix it?!
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 04:55 PM
UGH! Bump!
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 05:38 PM
Man, guys... I can't tell you how much I appreciate the help you're giving me! Thank you from the deepest of my heart, thank you!!!!!
Report Abuse
harutsedo is not online. harutsedo
Joined: 11 Oct 2009
Total Posts: 5150
13 Sep 2010 05:39 PM
Move the function up the script, then.
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 05:59 PM
This is the output of this script...

attempt to call a nil value
Disconnected event because of exception
Players.Player.Backpack.Auto Pistol.PaintballShooter:76: attempt to call global 'nofiar' (a nil value)


Tool = script.Parent
colors = {24}
local a = 0
function onButton1Down(mouse)
a = 1
end
function nofair(mouse)
a = 0
end
function fire(v)
Tool.Handle.Fire:play()
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local missile = Instance.new("Part")
local spawnPos = vCharacter.PrimaryPart.Position
spawnPos = spawnPos + (v * 8)
missile.Position = spawnPos
missile.Size = Vector3.new(0.2,0.2,0.2)
missile.Velocity = v * 641
missile.BrickColor = BrickColor.new(colors[math.random(1, #colors)])
missile.Shape = 0.5
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Paintball"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = 1
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,75,0)
force.Parent = missile
Tool.BrickCleanup:clone().Parent = missile
local new_script = script.Parent.Paintball:clone()
new_script.Disabled = false
new_script.Parent = missile
local mesh = Tool.Mesh:clone()
mesh.Parent = missile
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
end
function check(en)
if (Tool.Enabled == false) then
return false
end
if (Tool.Enabled == true) then
return true
end
end
Tool.Enabled = true
while a == 1 do
function onActivated()
if not Tool.Enabled then
return
end
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
if (check()) then
fire(lookAt)
wait(0.05)
onActivated()
end
return
end
end
script.Parent.Activated:connect(onActivated)
function Equip(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() nofiar(mouse) end)
end
Tool.Equipped:connect(Equip)
Report Abuse
harutsedo is not online. harutsedo
Joined: 11 Oct 2009
Total Posts: 5150
13 Sep 2010 06:03 PM
Third line from the end. You misspelled nofair().
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 07:10 PM
Oops! It still gives me the same output as it gave me at the beggining though... :/
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 07:47 PM
Bump!!
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 08:43 PM
Bump! :(
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
13 Sep 2010 08:54 PM
BUMP!
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 07:16 AM
It's still giving me "Attempt to call a nil value!" I'm so lost!!! I have absolutly no idea what the problem is!!
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 04:52 PM
B to the U to the M to the P
I really wish some one would help me!
:P Rap's stupid lol
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 05:10 PM
*sigh*
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 05:23 PM
bump
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 05:52 PM
bump
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 06:30 PM
bump
Report Abuse
purnuttin is not online. purnuttin
Joined: 09 Jul 2010
Total Posts: 257
14 Sep 2010 06:32 PM
move the function 'nofiar' above where you call it or move where you call it below it.
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 07:32 PM
I did what you said but it gave me the same output. UGH!!!!
Report Abuse
acid1103 is not online. acid1103
Joined: 28 Jul 2009
Total Posts: 1574
14 Sep 2010 07:42 PM
I can't believe this thread's been up for two days yet i've gotton NO help!!!!
Report Abuse
theblablybla is not online. theblablybla
Joined: 03 Jul 2009
Total Posts: 7959
14 Sep 2010 08:04 PM
Bump! Did dat helpz? '3'?
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