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: Projectile not spawning.

Previous Thread :: Next Thread 
derfvb123 is not online. derfvb123
Joined: 23 Oct 2011
Total Posts: 704
07 Jan 2016 07:34 PM
The script isnt working, the projectile isnt spawning...Help?




local player = game.Players.LocalPlayer
local char = player.Character

function GetBullet()
local p = game.ReplicatedStorage.Main.Projectiles.Beam:Clone()
p.CanCollide = false
Instance.new("BodyVelocity",p)
return p
end





script.Parent.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
local mH = mouse.Hit
local bullet = GetBullet()
bullet.CFrame = script.Parent.Handle.CFrame * CFrame.new(char.Torso.CFrame.lookVector * 2)
bullet.CFrame = CFrame.new(bullet.Position, mH.p)
bullet.BodyVelocity.velocity = bullet.CFrame.lookVector * 120
bullet.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(10)
end
end)
end)
end)







One day at a time, this is enough. Don't look back and grieve over the past for it is gone. Do not be troubled about the future, for it has yet to come. Live in the present and make it so beautiful that it will be worth remembering.-Ash
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
07 Jan 2016 07:35 PM
When you clone something it's parent is automagically nil.
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
07 Jan 2016 07:36 PM
function GetBullet()
local p = game.ReplicatedStorage.Main.Projectiles.Beam:Clone()
p.CanCollide = false
p.Parent.Game.Workspace
Instance.new("BodyVelocity",p)
return p
end
Report Abuse
derfvb123 is not online. derfvb123
Joined: 23 Oct 2011
Total Posts: 704
07 Jan 2016 07:42 PM
Got an error on "instance.new"


function GetBullet()
local p = game.ReplicatedStorage.Main.Projectiles.Beam:Clone()
p.CanCollide = false
p.Parent.Game.Workspace
Instance.new("BodyVelocity",p)
return p
end


Error expected '=' got 'instnace'



One day at a time, this is enough. Don't look back and grieve over the past for it is gone. Do not be troubled about the future, for it has yet to come. Live in the present and make it so beautiful that it will be worth remembering.-Ash
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
07 Jan 2016 07:42 PM
then just switch it to before i set the parent, lol
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
07 Jan 2016 07:43 PM
also parent = game.Workspace sorry imm tired dont expect alot from me ive fallen asleep 4 times within 2 hours.
Report Abuse
62GB is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
07 Jan 2016 07:44 PM
No offense but if you were able to make this script you should know how to parent a bullet to the workspace. Unless this isn't your script. Again, no offense. :-)

But here,

function GetBullet()
local p = game.ReplicatedStorage.Main.Projectiles.Beam:Clone()
p.CanCollide = false
p.Parent = game.Workspace
Instance.new("BodyVelocity",p)
return p
end
Report Abuse
derfvb123 is not online. derfvb123
Joined: 23 Oct 2011
Total Posts: 704
07 Jan 2016 07:45 PM
Had to use a tutorial to make this, as I couldnt figure out how to make a model into a projectile<




One day at a time, this is enough. Don't look back and grieve over the past for it is gone. Do not be troubled about the future, for it has yet to come. Live in the present and make it so beautiful that it will be worth remembering.-Ash
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
07 Jan 2016 07:46 PM
@62 thx for fixing it, as i said ive gotten little sleep and am very tired.
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