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 » Scripters
Home Search
 

Re: I want the rays to go through stuff.

Previous Thread :: Next Thread 
Crythox is not online. Crythox
Joined: 03 Oct 2011
Total Posts: 1188
06 Jan 2015 10:07 PM
local ray = Ray.new(script.Parent.Barrel.CFrame.p, (Find.Position - script.Parent.Barrel.CFrame.p).unit*300)
local hit, position = game.Workspace:FindPartOnRay(ray, user)




local distance = (position - script.Parent.Barrel.CFrame.p).magnitude
local rayPart = Instance.new("Part", user)
rayPart.Name = "RayPart"
rayPart.BrickColor = BrickColor.new("Brown")
rayPart.Transparency = 0.4
rayPart.Anchored = true
rayPart.CanCollide = false
rayPart.TopSurface = Enum.SurfaceType.Smooth
rayPart.BottomSurface = Enum.SurfaceType.Smooth
rayPart.formFactor = Enum.FormFactor.Custom
rayPart.Size = Vector3.new(0.2, 0.2, distance)
rayPart.CFrame = CFrame


They stop the ray when something is in their way D:

Please help fix this code.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
06 Jan 2015 10:09 PM
Try FindPartOnRayWithIgnoreList I think
Report Abuse
Crythox is not online. Crythox
Joined: 03 Oct 2011
Total Posts: 1188
06 Jan 2015 10:13 PM
I do not know much of ray casting, could you edit this?? Or tell me what to do?
Report Abuse
Crythox is not online. Crythox
Joined: 03 Oct 2011
Total Posts: 1188
06 Jan 2015 10:14 PM
Changing that made it not work at all.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jan 2015 10:25 PM
The second argument should be a table containing everything you want to ignore
Report Abuse
Crythox is not online. Crythox
Joined: 03 Oct 2011
Total Posts: 1188
06 Jan 2015 10:26 PM
I actually by surprise understood everything you said ;o

But, just how am I supposed to insert every single object except the enemies to ignore?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jan 2015 10:31 PM
What are enemies in your case? Players on different teams or?
Report Abuse
Crythox is not online. Crythox
Joined: 03 Oct 2011
Total Posts: 1188
06 Jan 2015 10:34 PM
This is the upper part I just added. The output says Unable to cast Object or something



function LookForPlayer()
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
return v
end
end
end


local player = LookForPlayer()
local user = {user,player}
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
06 Jan 2015 10:37 PM
Why not just use this to get the first thing with a humanoid in it?

local humanoid = workspace:FindFirstChild("Humanoid", true);
if humanoid then
return humanoid.Parent;
end
Report Abuse
Crythox is not online. Crythox
Joined: 03 Oct 2011
Total Posts: 1188
06 Jan 2015 10:39 PM
Fixed it, thanks for your guys help c:
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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