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: part goes along raycast?

Previous Thread :: Next Thread 
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
16 Jan 2017 03:10 PM
i've made it this far without messing up, considering my terrible skills as a scripter, and me attempting to make a gun, i have a predicament, after learning raycasting, my question is. how do i make a part run along the ray

script:

Tool.Activated:connect(function()
if db == true then
db = false
if Particles == true then
PS1.Transparency = 0.2
PS11.Transparency = 0.2
PS111.Transparency = 0.2
ShotGun:Play()
local ray = Ray.new(Tool.Holder.Position, (mouse.hit.p - Tool.Holder.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true)
local BulletLine = Instance.new("Part", workspace)
BulletLine.Material = Enum.Material.Neon
BulletLine.BrickColor = BrickColor.new("Really red")
BulletLine.FormFactor = "Custom"
BulletLine.Transparency = 0.25
BulletLine.Anchored = true
BulletLine.Locked = true
BulletLine.CanCollide = false
local distance = (Tool.Holder.Position - position).magnitude
BulletLine.Size = Vector3.new(0.1, 0.1, distance)
BulletLine.CFrame = CFrame.new(Tool.Holder.Position, position) * CFrame.new(0, 0, -distance/2)
game.Debris:AddItem(BulletLine, 0.5)
if part then
local humanoid = part.Parent:findFirstChild("Humanoid")
if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
humanoid:TakeDamage(50)
end
end

--Bullet Follows The Ray



wait(0.3)
ShotGun2:Play()
PS1.Transparency = 1
PS11.Transparency = 1
PS111.Transparency = 1
wait(FireRate)
db = true


This is siggy. he does not like people. he will bite
Report Abuse
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
16 Jan 2017 03:15 PM
bump


This is siggy. he does not like people. he will bite
Report Abuse
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
16 Jan 2017 03:20 PM
my bad

Tool.Activated:connect(function()
if db == true then
db = false
if Particles == true then
PS1.Transparency = 0.2
PS11.Transparency = 0.2
PS111.Transparency = 0.2
ShotGun:Play()
local ray = Ray.new(Tool.Holder.Position, (mouse.hit.p - Tool.Holder.CFrame.p).unit * 300)
local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true)
local BulletLine = Instance.new("Part", workspace)
BulletLine.Material = Enum.Material.Neon
BulletLine.BrickColor = BrickColor.new("Really red")
BulletLine.FormFactor = "Custom"
BulletLine.Transparency = 0.25
BulletLine.Anchored = true
BulletLine.Locked = true
BulletLine.CanCollide = false
local distance = (Tool.Holder.Position - position).magnitude
BulletLine.Size = Vector3.new(0.1, 0.1, distance)
BulletLine.CFrame = CFrame.new(Tool.Holder.Position, position) * CFrame.new(0, 0, -distance/2)
game.Debris:AddItem(BulletLine, 0.5)
if part then
local humanoid = part.Parent:findFirstChild("Humanoid")
if not humanoid then
humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
end
if humanoid then
humanoid:TakeDamage(50)
end
end
local Bullet = game.ServerStorage.Bullet:Clone()
Bullet.Parent = game.Workspace
Bullet.Anchored = false
Bullet.Position = BulletHolder.Position
Bullet.CanCollide = false



--Bullet Follows The Ray



wait(0.3)
ShotGun2:Play()
PS1.Transparency = 1
PS11.Transparency = 1
PS111.Transparency = 1
wait(FireRate)
db = true
else


forgot to include adding the bullet


This is siggy. he does not like people. he will bite
Report Abuse
HalfPinky456 is not online. HalfPinky456
Joined: 10 Apr 2011
Total Posts: 6236
16 Jan 2017 03:22 PM
on the wiki, there is a page about making a laser thing with raycasting
maybe it can help you with the following bullet part
Report Abuse
StringedVortex is not online. StringedVortex
Joined: 28 Jun 2015
Total Posts: 1846
16 Jan 2017 03:30 PM
^ i read it up and down and didn't find anything..


This is siggy. he does not like people. he will bite
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