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: BodyForces? (easy question)

Previous Thread :: Next Thread 
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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 is not online. 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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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 is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jul 2016 05:07 AM
cframe and math?


- Isosta
Report Abuse
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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 is not online. 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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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 is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jul 2016 05:15 AM
set their CFrame?


- Isosta
Report Abuse
Isosta is not online. 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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
17 Jul 2016 08:01 AM
bump


im not a jerk but homie u 5
Report Abuse
ComedicGesture is not online. ComedicGesture
Joined: 20 May 2011
Total Posts: 912
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
supremebloxboy is not online. supremebloxboy
Joined: 12 Jun 2010
Total Posts: 424
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
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