I wish to change the projectile of a tool / weapon that uses raycast in it's scripting. Heres a code snippet of the current tool's code from the original version first to my modified version that I am in the process of changing.
Original Projectile Code:
Bullet=Instance.new("Part") Bullet.Name="Bullet" Bullet.BrickColor=BrickColor.new("Really red") Bullet.Anchored=true Bullet.CanCollide=false Bullet.Locked=true Bullet.Size=Vector3.new(1,1,1) Bullet.formFactor=0 Bullet.TopSurface=0 Bullet.BottomSurface=0 Bullet.Transparency = 0.5 mesh=Instance.new("BlockMesh") mesh.Parent=Bullet mesh.Name="Mesh" mesh.Scale=Vector3.new(.05,.05,1
Modified Projectile Code:
Bullet=Instance.new("Part") Bullet.Name="Lasbolt" Bullet.BrickColor=BrickColor.new("Bright red") Bullet.Anchored=true Bullet.CanCollide=false Bullet.Locked=true Bullet.Size=Vector3.new(1,1,1) Bullet.FormFactor=0 Bullet.TopSurface=0 Bullet.BottomSurface=0 Bullet.Transparency = 0.5 mesh=Instance.new("CylinderMesh") mesh.Parent=Bullet mesh.Name="Mesh" mesh.Scale=Vector3.new(.05,.05,1)
I'm trying to change the original 'ray' projectile fired by the script into a cylinder mesh, but it doesn't seem to be working correctly. I'm really new to the world of scripting, becoming really involved after wishing to start my own clan, and I'd like some aid from more experienced veterans of ROBLOX. If there is another way to change the projectile into a cylinder mesh instead of a block one please inform me as soon as you can.
Your issue is that you never parented the original bullet brick. Instance.new() takes a second optional parameter that lets you decide where the part is parented. So if you wanted it to be in Workspace then you can set it up like this.
Bullet=Instance.new("Part", Workspace) --Added workspace as a 2nd parameter Bullet.Name="Lasbolt" Bullet.BrickColor=BrickColor.new("Bright red") Bullet.Anchored=true Bullet.CanCollide=false Bullet.Locked=true Bullet.Size=Vector3.new(1,1,1) Bullet.FormFactor=0 Bullet.TopSurface=0 Bullet.BottomSurface=0 Bullet.Transparency = 0.5 mesh=Instance.new("CylinderMesh") mesh.Parent=Bullet mesh.Name="Mesh" mesh.Scale=Vector3.new(.05,.05,1)
After doing that, the bullet was indeed created and you could see it. Just parent it to whatever you want it to be.