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: FindPartOnRayWithIgnoreList(Method) question

Previous Thread :: Next Thread 
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:08 AM
why whenever i use hit, hitlocation = FindPartOnRay(x, b) it works fine(x being the ray, b being the hit position) but with the FindPartOnRayWithIgnoreList() it doesn't work the same way?
i'm trying to use it in the same way but ignore my player's character, i'm not sure how
http://wiki.roblox.com/index.php?title=FindPartOnRay_(Method)
-=Robo=-
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:09 AM
The second argument requires a table for that method
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:10 AM
then where does b come into play?
i'm confused, why does it have to be a table if with the original, it recognizes b as position? how do i get position? o.o
-=Robo=-
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:11 AM
workspace:FindPartOnRayWithIgnoreList(ray, {ignoredObjectA, ignoredObjectB, ...})
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:13 AM
what if i have the table set to a variable, like say... z?
and that still doesn't explain how i get the pos.
here's an excerpt from the script i'm working on;
x = Ray.new(Handle.Handle.Position,(shotlocation - Handle.Handle.Position).unit*500)
hit, hitpos = game.Workspace:FindPartOnRayWithIgnoreList (x,b)
print(x)
CreateBullet(z)
z.Position = hitpos
why am i so confused on this, am i explaining it right?
-=Robo=-
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:14 AM
hitpos is given, think of it as "FindPartOnRay" but you can ignore multiple objects, instead of just 1
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:16 AM
are you sure that's correct?
it's still erroring. ;-; unable to cast value to object.
-=Robo=-
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:18 AM
Post what you are currently doing
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:18 AM
including what b and z is.
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:20 AM
ignoreplayer = {script.Parent.Parent:GetChildren()}
function CreateBullet()
z = Instance.new("Part",Gun)
z.FormFactor = Enum.FormFactor.Custom
z.Transparency = 0
z.Anchored = true
z.Name = "Bullet"
z.CanCollide = false
z.BrickColor = BrickColor.new("Green")
z.Size = Vector3.new(.01,.01,.01)
f = Instance.new("Smoke",z)
f.Color = Color3.new(255, 255, 255)
f.Opacity = 1
f.Size = 0.1
f.RiseVelocity = 0
end
Handle = script.Parent
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()
shotlocation = mouse.Hit.p
print(shotlocation)
enabled = true
IsFiring = true
Firing()
end)
Gun.Deactivated:connect(function()
IsFiring = false
end)
function Firing()
repeat
wait(1/100)
if not shotlocation then
print("u did it agin")
end
x = Ray.new(Handle.Handle.Position,(shotlocation - Handle.Handle.Position).unit*500)
hit, hitpos = game.Workspace:FindPartOnRayWithIgnoreList (x,{script.Parent.Parent:GetChildren()})
print(x)
CreateBullet(z)
z.Position = hitpos
if z == nil then
print("bullet hit doesn't exist, why?")
else
print("robocu3 boss <3")
end

there's the script up to the point where it errors.
-=Robo=-
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:23 AM
What line number is the output giving you?
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:24 AM
00:19:25.816 - Unable to cast value to Object
00:19:25.817 - Script 'Workspace.Player1.Gun2.LocalScript', Line 46 - global Firing
00:19:25.817 - Script 'Workspace.Player1.Gun2.LocalScript', Line 34
00:19:25.818 - stack end
-=Robo=-
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:25 AM
http://wiki.roblox.com/index.php?title=FindPartOnRayWithIgnoreList_(Method)
as it would appear the wiki doesn't state it returns vector3 in the description, only the part it hits.
is this inaccurate and lazy writing or is it truth?
-=Robo=-
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Mar 2014 12:27 AM
Remove the braces, GetChildren already returns a table.
Report Abuse
robocu3 is not online. robocu3
Joined: 13 Mar 2009
Total Posts: 6485
18 Mar 2014 12:29 AM
:3 it works! thank you! :D
-=Robo=-
Report Abuse
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
18 Mar 2014 04:36 AM
can i get a wiki for this? please :P
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