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: Bad argument error:

Previous Thread :: Next Thread 
0rka is not online. 0rka
Joined: 26 Dec 2013
Total Posts: 1070
25 Mar 2014 02:50 PM
if tracers == true then -- A bullet will not be created unless tracers is set to true, this helps prevent lag
local bullet = Instance.new("Part", game.Workspace) -- Create the bullet
bullet.FormFactor = "Custom"
bullet.CanCollide = false
bullet.BrickColor = BrickColor.new("Dark stone grey")
bullet.Size = Vector3.new(.2, .2, .2)
local light = Instance.new("BillboardGui", bullet) -- Create the light
local lightFrame = Instance.new("ImageLabel", light)
light.Size = UDim2.new(6, 0, 6, 0)
lightFrame.BackgroundTransparency = 1
lightFrame.Image = "http://www.roblox.com/asset/?id=43708803"
lightFrame.Size = UDim2.new(1, 0, 1, 0)
light.Adornee = bullet
local character = tool.Parent
local spawnPos = character.PrimaryPart.Position
local humanoid = character.Humanoid
local targetpos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit --[[ this line is the error; it says Players.0rka.Backpack.SVT-40 Ray.Teutonic Shooter:59: bad argument #1 to '?' (Vector3 expected, got nil)
15:46:48.172 - Script 'Players.0rka.Backpack.SVT-40 Ray.Teutonic Shooter', Line 59
15:46:48.173 - stack end]]
spawnPos = spawnPos + (lookAt * 8)
bullet.Position = spawnPos
bullet.Velocity = lookAt * 6000
local force = Instance.new("BodyForce")
force.force = Vector3.new(0, bullet:getMass() * 196, 0)
force.Parent = part
wait(.4)
bullet:Remove()
end
Report Abuse
BlackBucketBoy is not online. BlackBucketBoy
Joined: 22 Jul 2011
Total Posts: 3230
25 Mar 2014 02:51 PM
good job on just pasting the script

maybe next time add a description on what you need help with
Report Abuse
0rka is not online. 0rka
Joined: 26 Dec 2013
Total Posts: 1070
25 Mar 2014 02:53 PM
I did, if you'd read it. --[[ this line is the error; it says Players.0rka.Backpack.SVT-40 Ray.Teutonic Shooter:59: bad argument #1 to '?' (Vector3 expected, got nil)
15:46:48.172 - Script 'Players.0rka.Backpack.SVT-40 Ray.Teutonic Shooter', Line 59
15:46:48.173 - stack end]]

Get out moron.
Report Abuse
0rka is not online. 0rka
Joined: 26 Dec 2013
Total Posts: 1070
25 Mar 2014 02:55 PM
bump
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
25 Mar 2014 02:58 PM
I can't test anything at the moment, but my suspicion is that Humanoid.TargetPoint is nil unless the player is walking somewhere. Therefore, targetPos is nil. I could be wrong, but try testing to see if it is not nil before performing arithmetic.
Report Abuse
0rka is not online. 0rka
Joined: 26 Dec 2013
Total Posts: 1070
25 Mar 2014 02:59 PM
Lol, silly capitalization error.
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
25 Mar 2014 03:04 PM
Haha gets me every time
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