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 » Scripting Helpers
Home Search
 

Re: Let's say I need to wait a certain amount of time

Previous Thread :: Next Thread 
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 07:57 PM
I'm making a gun, and I want to wait() so long to interprate a the time it takes a bullet to travel.

Lets say one foot is 2 feet.
If the feetpersecond is 2000, what equation would I put to wait() the correct amount of time based on the distance(dis)
Report Abuse
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
23 Aug 2014 07:58 PM
What is the distance...?

If you look closely, I don't give a crap.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 07:59 PM
Distance is dis, which could be any number, but for example its 500
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:01 PM
Wouldn't it be easier and better to just like. Get the time it was fired and then get the time it hit and get the time or something based on that.
Report Abuse
Distortional is not online. Distortional
Joined: 22 Nov 2011
Total Posts: 6530
23 Aug 2014 08:02 PM
^I support that.

If you look closely, I don't give a crap.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:02 PM
I'm using two raycasts one to get the distance and the second to hit the player.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:03 PM
Why do you even want to do this.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:04 PM
To simulate the time it takes the bullet to travel..

Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:05 PM
What are you even going to do with the information of knowing how long it took to travel. You can just get the time it was fired and the time it hit to get dat info by figuring out what the gap in-between is.
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
23 Aug 2014 08:08 PM
"Lets say one foot is 2 feet." wtf
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:09 PM
...


You don't know what I'm doing right?


I send the ray, the distance is gotten by the first ray.

Than I wait() the amount of time based on the distance and the feetpersecond.
Than I send the second ray from and two the same points as the first ray and if theres still a part there than I damage it.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:09 PM
Lets say one foot is 2 studs, sorry.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:10 PM
Why not stop usin rays and just fire an actual projectile. Derp
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:12 PM
Because they are unreliable, laggy, and garbage.
Rays are far more superior.
Now if you could please just figure out my problem instead of criticizing me that would be great.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:13 PM
"Rays are far more superior."
ooops I mean far superior.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:17 PM
They aren't 'laggy'. They add in as many parts as a ray would. Also, if you know how to do them right they aren't 'unreliable'.
And a projectile can look much nicer than a ray. Would you prefer: a tiny ball shot from a gun that moves very quickly and looks realistic OR a freaking laser coming from your gun that makes it very easy for someone to see where you are.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:18 PM
let me explain again..

I have the distance between two spots, lets say thats 500.
Now I have the speed in which the bullet is traveling, which is 6000 studs per second

How do I figure out how long it will take to travel the 500 studs?
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:19 PM
It will take a 12th of a second.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
23 Aug 2014 08:20 PM
Cause 500 = 1/12 of 6000

such simple maths
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:20 PM
speed=distance/time

So would I do distance*speed or distance/speed or speed/distance or something?
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
23 Aug 2014 08:21 PM
--create ray.

local hit = Instance.new("BoolValue", bullet);
hit.Name = "impact";
local value = Instance.new("IntValue", bullet)-- create the bullet var
value.Name = "distanceTime";
coroutine.wrap(function()
while not (hit.Value == true) do
value.Value = value.Value + 1;
wait(1);
end
end)()
if (RayImpactVariableHere) then
hit.Value = true;
end
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:21 PM
It was an example I'm doing algebra distance could be 193 or 806 and feetpersecond could be 5000 or 7000 or 2032.
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
23 Aug 2014 08:22 PM
Ok nvm. you might want to make the speed of the bullet, then use the wait function and divide it's time by something in the while loop. idk
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:22 PM
I already have the rays I'm trying to figure out how long to wait() to simulate the time it takes a bullet to move that distance..


You are way over complicating things with your questions.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
23 Aug 2014 08:23 PM
The bullet is nothing! There is no bullet! THe speed is just a number and the distance is just a number.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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