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
 

RayCasting error

Previous Thread :: Next Thread 
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 09:10 PM
Nothing in output, And it makes the part, Just dosnt make it anywhere you can see it

function onTouch(part)
Lazor = Ray.new(script.Parent.CFrame.p, (script.Parent.CFrame.p - script.Parent.CFrame.p).unit*300)
hit, position = game.Workspace:FindPartOnRay(Lazor, script.Parent)
--Raycasting end


--Damage start
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid"):TakeDamage(30)
end
--Damage end


--Part maker start
Part = Instance.new("Part", workspace)
Part.Name = "Lazor"
Part.BrickColor = BrickColor.new("Really red")
Part.Transparency = 0.75
Part.Anchored = true
Part.CanCollide = false
Part.TopSurface = "Smooth"
Part.BottomSurface = "Smooth"
Part.formFactor = "Custom"
Part.Size = Vector3.new(0.2, 0.2, (position - script.Parent.CFrame.p).magnitude)
Part.CFrame = CFrame.new(position, script.Parent.CFrame.p) * CFrame.new(0, 0, -(position - script.Parent.CFrame.p).magnitude/2)
game.Debris:AddItem(Part, 0.5)
--Part maker end

end
script.Parent.Touched:connect(onTouch)
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 09:23 PM
I found a way to fix it

But line 2 needs another part now...Anyone know how to fix it?
Report Abuse
gametastic100 is not online. gametastic100
Joined: 15 Jun 2011
Total Posts: 1286
20 Nov 2012 09:25 PM
Output and new script?
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 09:29 PM
New script crashed because I added a while true do and forgot waits xP

Hang on
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 09:30 PM
Like I said, No output and

function onTouch(part)
Lazor = Ray.new(script.Parent.CFrame.p, (workspace.Part.CFrame.p - script.Parent.CFrame.p).unit*300)
hit, position = game.Workspace:FindPartOnRay(Lazor, script.Parent)
--Raycasting end


--Damage start
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid"):TakeDamage(30)
end
--Damage end


--Part maker start
Part = Instance.new("Part", workspace)
Part.Name = "Lazor"
Part.BrickColor = BrickColor.new("Really red")
Part.Transparency = 0.75
Part.Anchored = true
Part.CanCollide = false
Part.TopSurface = "Smooth"
Part.BottomSurface = "Smooth"
Part.formFactor = "Custom"
Part.Size = Vector3.new(0.2, 0.2, (position - script.Parent.CFrame.p).magnitude)
Part.CFrame = CFrame.new(position, script.Parent.CFrame.p) * CFrame.new(0, 0, -(position - script.Parent.CFrame.p).magnitude/2)
game.Debris:AddItem(Part, 0.5)
--Part maker end

end
script.Parent.Touched:connect(onTouch)
Report Abuse
gametastic100 is not online. gametastic100
Joined: 15 Jun 2011
Total Posts: 1286
20 Nov 2012 09:55 PM
function onTouch(part)
Lazor = Ray.new(script.Parent.CFrame.p, (workspace.Part.CFrame.p - script.Parent.CFrame.p).unit*300)
hit, position = game.Workspace:FindPartOnRay(Lazor, script.Parent)
--Raycasting end


--Damage start
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid"):TakeDamage(30)
end
--Damage end


--Part maker start
Part = Instance.new("Part", Workspace)
Part.Name = "Lazor"
Part.BrickColor = BrickColor.new("Really red")
Part.Transparency = 0.75
Part.Anchored = true
Part.CanCollide = false
Part.TopSurface = "Smooth"
Part.BottomSurface = "Smooth"
Part.formFactor = "Custom"
Part.Size = Vector3.new(0.2, 0.2, (position - script.Parent.CFrame.p).magnitude)
Part.CFrame = CFrame.new(position, script.Parent.CFrame.p) * CFrame.new(0, 0, -(position - script.Parent.CFrame.p).magnitude/2)
game.Debris:AddItem(Part, 0.5)
--Part maker end

end
script.Parent.Touched:connect(onTouch)

Why is it onTouch?
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 09:58 PM
Im trying to make a button to send out the ray

The thing is

workspace.Part.CFrame.p

I dont want it needing another part to have to go to, I want it to just go
Report Abuse
gametastic100 is not online. gametastic100
Joined: 15 Jun 2011
Total Posts: 1286
20 Nov 2012 10:00 PM
did you define p?
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 10:01 PM
P is a part of CFrame.

The script works fine, I just need it to not need that second part.
Report Abuse
gametastic100 is not online. gametastic100
Joined: 15 Jun 2011
Total Posts: 1286
20 Nov 2012 10:04 PM
function onTouch(part)
Lazor = Ray.new(script.Parent.CFrame.p, (workspace.Part.CFrame.p - script.Parent.CFrame.p).unit*300)
hit, position = game.Workspace:FindPartOnRay(Lazor, script.Parent)
--Raycasting end


--Damage start
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid"):TakeDamage(30)
end
--Damage end


--Part maker start
Part = Instance.new("Part", Workspace)
Part.Name = "Lazor"
Part.BrickColor = BrickColor.new("Really red")
Part.Transparency = 0.75
Part.Anchored = true
Part.CanCollide = false
Part.TopSurface = "Smooth"
Part.BottomSurface = "Smooth"
Part.formFactor = "Custom"
Part.Size = Vector3.new(0.2, 0.2, (position - script.Parent.CFrame.p).magnitude)
Part.CFrame = CFrame.new(position, script.Parent.CFrame.script.Parent) * CFrame.new(0, 0, -(position - script.Parent.CFrame.script.Parent).magnitude/2)
game.Debris:AddItem(Part, 0.5)
--Part maker end

end
script.Parent.Touched:connect(onTouch)


LolIfailded
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 10:05 PM
Thats the same thing...
Report Abuse
CaptainSandbox is not online. CaptainSandbox
Joined: 08 Oct 2012
Total Posts: 908
20 Nov 2012 11:21 PM
Lah bump
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