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: Alternative to using TargetPoint for weapon aim?

Previous Thread :: Next Thread 
SpartanJose777 is not online. SpartanJose777
Joined: 02 Nov 2007
Total Posts: 2002
30 Jul 2012 12:01 PM
Hi, guys. So, in the standard paintball script that Roblox uses, a weapon's fired through function(fire)which describes, uh... firing the weapon. However, the part of the script that describes AIMING the weapon is as follows;

local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit

At which point there's a part of the script which makes it so when you click the mouse you fire at lookAt. All very good.

My question to you guys is this; is there an alternative method other than using humanoid.TargetPoint to get the coordinates to where your character is pointing his cursor? I don't care if they're obscure or really random; I'd like to see as many alternatives as possible.
Report Abuse
SpartanJose777 is not online. SpartanJose777
Joined: 02 Nov 2007
Total Posts: 2002
30 Jul 2012 12:26 PM
Oh, come on. Someone has to know.
Report Abuse
SpartanJose777 is not online. SpartanJose777
Joined: 02 Nov 2007
Total Posts: 2002
30 Jul 2012 01:36 PM
Bump.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 01:37 PM
Location of mouse in 3d space = mouse.Hit. That returns a CFrame value so for position, use mouse.Hit.p.
Report Abuse
SpartanJose777 is not online. SpartanJose777
Joined: 02 Nov 2007
Total Posts: 2002
30 Jul 2012 02:07 PM
Hrm. And how would I access mouse.Hit if I were trying to get to it from outside the tool?
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
30 Jul 2012 02:08 PM
I don't know if that's possible... D:
Report Abuse
SpartanJose777 is not online. SpartanJose777
Joined: 02 Nov 2007
Total Posts: 2002
30 Jul 2012 02:10 PM
...Darn. So, then, are there any OTHER alternatives to using mouse.Hit or Targetpoint?

This is a lot harder than I expected.
Report Abuse
Z3R0xT0L3R4NC3 is not online. Z3R0xT0L3R4NC3
Joined: 06 Feb 2011
Total Posts: 127
30 Jul 2012 02:12 PM
It is, just really difficult. Add a GUI that takes up the entire screen. Use the MouseEnter event to get the mouse's coordinates. Use some complicated math to find out where thet is in the game. Find what's at that position. And there you have it. I remember seeing a forum about this that was trying to have a GUI follow a person in the game. Might wanna look that up and find it.
Report Abuse
BrandonFireflower is not online. BrandonFireflower
Joined: 09 Feb 2010
Total Posts: 731
30 Jul 2012 02:16 PM
One way is to make them equip a HopperBin to teleport to a spawn point and then change the parent of the HopperBin to nil. You'll get mouse.Hit access for eternity!

Or until they die I think.

--BrandonFireflower, LuaLearners Writer and president of the Exodus Task Force.
Report Abuse
SpartanJose777 is not online. SpartanJose777
Joined: 02 Nov 2007
Total Posts: 2002
30 Jul 2012 02:17 PM
...Well, that wouldn't work for my purposes either.

This is rapidly descending into insanity. Are there any other alternatives beyond THAT? If not, I'm gonna have to use mouse.Hit to change a Vector3 value that's then going to be referenced by another script, resulting in what is colloquially known as "wailing and gnashing of teeth." -_-
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