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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|