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't find vector3?

Previous Thread :: Next Thread 
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
05 Mar 2014 09:51 PM
function CreateBullet()
z = Instance.new("Part")
z.FormFactor = Enum.FormFactor.Custom
z.Size = Vector3.new(.01,.01,.01)
end
Handle = script.Parent
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
Player = game.Players.LocalPlayer
Spread = 5
Gun = script.Parent
mouse = Player:GetMouse()
Ammo = 5
MuzzleFlash1 = Gun.MuzzleFlash
MuzzleFlash2 = Gun.MuzzleFlash2
MuzzleLight = Gun.MuzzleLight.light
Gun.Equipped:connect(function()
mouse.Icon = "http://www.roblox.com/asset/?id=59273131"
end)
Gun.Activated:connect(function()
enabled = true
IsFiring = true
Firing()
end)
Gun.Deactivated:connect(function()
IsFiring = false
end)
function Firing()
repeat
wait(1/100)
local shootDirection = (mouse.Hit.p - script.Parent.Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
-- moves random*spread in a random angle from center shot point (center bias)
shootDirection = ((CFrame.new(Vector3.new(0,0,0),shootDirection) * CFrame.Angles(0,0,math.random()*2*math.pi))*CFrame.Angles(math.random()*Spread,0,0)).lookVector
local hitObject, bulletPos = RayCast(Handle.Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
user = nil
MuzzleFlash1.Transparency = .6
MuzzleFlash2.Transparency = .8
MuzzleLight.Enabled = true
Shot = Instance.new("Sound",Gun)
Shot.SoundId = "http://www.roblox.com/asset/?id=132456317"
Shot.Pitch = math.random(100, 199)/100
Shot.Volume = 1
Shot.PlayOnRemove = true
wait(1/20)
MuzzleFlash1.Transparency = 1
MuzzleFlash2.Transparency = 1
MuzzleLight.Enabled = false
Shot:Remove()
until IsFiring ==false
end
---------
i know we're not supposed to post a long script but, i can't find where the error is and all output says is;
21:50:13.877 - attempt to multiply a Vector3 with an incompatible value type or nil; returning new zero-vector
-=Robo=-
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
05 Mar 2014 11:33 PM
i can't ever get any help. -_-
-=Robo=-
Report Abuse
ZeroSpectrum is not online. ZeroSpectrum
Joined: 02 Mar 2011
Total Posts: 315
05 Mar 2014 11:46 PM
what is "vec"? I can't find it anywhere on the script except the ray_cast function.
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
06 Mar 2014 12:12 AM
it's just the second argument to the function
-=Robo=-
Report Abuse
wubbzy301 is not online. wubbzy301
Joined: 15 May 2010
Total Posts: 1188
06 Mar 2014 12:49 AM
Use the line numbers, then use the script then find the numbers, check the output and find a line. Then put the spot over there and then give it to me!
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
06 Mar 2014 06:39 PM
^
...
uhm
i'm somewhat amateur and all i caught was line, can you reword that lol
-=Robo=-
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
06 Mar 2014 06:44 PM
Ill reword that:

In the script,there are numbers to the left side of it

Click view-output
And any errors will show up there
It'll be like
Error in script "script":5 attempt to index global mehehe
5 being the number
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
06 Mar 2014 07:36 PM
I posted the only output at the bottom of the first post, though. .-.
-=Robo=-
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
06 Mar 2014 11:12 PM
bopasdpkwodawpwakedowqpekoqw
-=Robo=-
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
07 Mar 2014 11:42 AM
bumpppp
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
07 Mar 2014 06:21 PM
COME ON
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
07 Mar 2014 10:28 PM
I HATE EVERYTHING YOU GUYS
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
07 Mar 2014 11:20 PM
wowww
cutting my wrists over here
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
08 Mar 2014 12:11 AM
This is such bs, I see people replying and helping others but when it comes to any of my posts I'm completely ignored.
-=Robo=-
Report Abuse
wubbzy301 is not online. wubbzy301
Joined: 15 May 2010
Total Posts: 1188
13 Mar 2014 12:21 AM
yea, FIND VECTOR 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