|
| 17 Jul 2016 04:44 AM |
I'm trying to make a gun that actually shoots bullets rather than raycasting. I'm still a noob to scripting and I don't know how to use the bodyforces. I put a bodyvelocity into each bullet but the bullets just don't move. I also made the velocity be 0,100,0. What am I supposed to do to make the bullets actuallt thrust forward or at least move at all
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 17 Jul 2016 05:02 AM |
use raycasting and have a bullet trace the ray. Raycasting isn't the laser beam you see in most games. Pretty sure phantom forces uses rays.
example:
https://www.roblox.com/games/438821549/Scripting-demo
- Isosta |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 05:03 AM |
I know how to raycast and I know how to make bullets but how do I make a bullet trace a ray?
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
| |
|
|
| 17 Jul 2016 05:08 AM |
I don't even know how to make the bullets move and you're telling me to make them move in a specified path... srsly?
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 17 Jul 2016 05:10 AM |
just use body forces. Do they need to follow the path exactly?
- Isosta |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 05:12 AM |
That's what I'm asking about! I put a body velocity into the bullet and I made the velocity was 100 and it's not moving. I need to know how to make it move.
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 05:14 AM |
I unachored the bricks and then they were still anchored so when I was testing I just kinda moved them with the move tool and they went shooting up. Is there a way to just make them move without me having to do that?
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
| |
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 17 Jul 2016 05:16 AM |
actually just do..
local part = bullet --whatever local ray = ray.new(stuff) part.Velocity = Vector3.new(ray.Direction)
- Isosta |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 05:18 AM |
ok that's my script. I already set the cframe right? do I need to set the cframe again later? also how would I make the bullet shoot in the direction it's facing rather than the one of the 3 axes
local gun = script.Parent local plr = game:GetService("Players").LocalPlayer
gun.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() local bullet = Instance.new("Part", game.Workspace) bullet.Size = Vector3.new(.2, .2, 1) bullet.CFrame = CFrame.new(gun.Handle.Position, mouse.Hit.p) local push = Instance.new("BodyVelocity", bullet) push.Velocity = Vector3.new(0,0,100) bullet.Anchored = false end) end)
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 05:18 AM |
i didn't see what you wrote before I wrote what I did I'm going to try that and et back to you on it.
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 05:24 AM |
local gun = script.Parent local plr = game:GetService("Players").LocalPlayer
gun.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() local bullet = Instance.new("Part", game.Workspace) bullet.Size = Vector3.new(.2, .2, 1) bullet.CFrame = CFrame.new(gun.Handle.Position, mouse.Hit.p) local push = Instance.new("BodyVelocity", bullet) local ray = Ray.new(gun.Handle.CFrame.p, mouse.Hit.p) push.Velocity = Vector3.new(ray.Direction) bullet.Anchored = false end) end)
that's my script now and it doesn't work still. The bullets stay still and when I mvoe them with the tool they slowly start going up or down.
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2016 08:01 AM |
bump
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2016 07:31 AM |
bump still not working. I feel like I've exhausted all my options
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 19 Jul 2016 08:32 AM |
Could it possibly be because you didn't set the MaxForce nor the "P" of the BodyVelocity
|
|
|
| Report Abuse |
|
|