Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
|
| 21 Mar 2017 01:50 PM |
The Question - How would I make something that only works in a certain area?
What I need an 'extreme' scripter for; I need a player of a certain team to be able to pick up blocks when pointing at them with the mouse, and holding down a button. So far i've asked about 5 people for help on this, yet none of them seemed to be advanced enough.
Thanks in advance :P
|
|
|
| Report Abuse |
|
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
| |
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
| |
|
RogueMage
|
  |
| Joined: 28 Jan 2012 |
| Total Posts: 1235 |
|
|
| 21 Mar 2017 02:26 PM |
Yeah haha no
Raycasting and run.RenderStepped |
|
|
| Report Abuse |
|
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
| |
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
| |
|
|
| 21 Mar 2017 02:41 PM |
| You will never learn more than learning to do it yourself. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2017 02:52 PM |
raycasting is ur best bet http://wiki.roblox.com/index.php?title=Ray
infact theres a bit of code that fits ur worries perfectly checks if mouse intersects sphere
if intersectsSphere(mouse.UnitRay, sphere.Position, sphere.Size.X/2) then -- handle collision end
takes a while to learn but hey dat how scripting is
are you not ENTERTAINED!??! |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Mar 2017 02:55 PM |
Raycasting isnt necessary, just use mouse.hit.p and magnitudes, im sure a magnitude check would be far more efficient than raycasting
local SuperPart = Instance.new("Egg") |
|
|
| Report Abuse |
|
|
C_Sharper
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 6405 |
|
|
| 21 Mar 2017 03:00 PM |
local player = game.Players.LocalPlayer local mouse = player:GetMouse()
mouse.MouseMoved:connect(function() if mouse.Target and mouse.Target.Name == "That Block" then print"Ok joe, we can pick up this block." end end) |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2017 03:10 PM |
"Ok joe, we can pick up this block."
are you not ENTERTAINED!??! |
|
|
| Report Abuse |
|
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
|
| 21 Mar 2017 03:42 PM |
Thanks for the help on the second question, though would still like an answer for the first one. "How would I make something that only works in a certain area?"
|
|
|
| Report Abuse |
|
|
|
| 21 Mar 2017 03:45 PM |
It depends on how you determine the allowed area. Is it a cube area, circular area, or any other shape? Is it a hard-coded area, or does this area move with some object within the game?
Can you give an example of what you're looking for? |
|
|
| Report Abuse |
|
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
|
| 21 Mar 2017 03:51 PM |
Just a square map. The only thing I could think of was putting a block which covers the whole area, making it transparent and unselect cancollide, and use the touching event. Btw nobody mentioned how to actually make the part follow the mouse.
|
|
|
| Report Abuse |
|
|
|
| 21 Mar 2017 03:56 PM |
Since it is a square map, I recommend using Region3 detection.
http://wiki.roblox.com/index.php?title=API:Region3
To get the position of the mouse pointer, use mouse.Hit.p for a Vector3, or mouse.Hit for a CFrame. |
|
|
| Report Abuse |
|
|
Dralian
|
  |
| Joined: 21 Mar 2013 |
| Total Posts: 7624 |
|
|
| 21 Mar 2017 03:57 PM |
'nobody told me how to move it with the mouse' not gonna tell u everything m8
also, no u dont need to use the touched brick thing thats eh. just take a side of the map, maybe put a part over it, take its position, and check the magnitude of the player to the part or w/e ur doing to see if it's able to move. if that makes sense. idk specifics for what you're doing sry. |
|
|
| Report Abuse |
|
|
Dralian
|
  |
| Joined: 21 Mar 2013 |
| Total Posts: 7624 |
|
|
| 21 Mar 2017 03:57 PM |
| that one of the more simplistic ways i can think of |
|
|
| Report Abuse |
|
|
Klighter
|
  |
| Joined: 04 Jan 2015 |
| Total Posts: 234 |
|
|
| 21 Mar 2017 04:02 PM |
Actually, I had already worked out how to get the part, but not how to actually move it with the mouse, which is the most 'complicated' part of this code.
|
|
|
| Report Abuse |
|
|
|
| 21 Mar 2017 05:51 PM |
i dunno if this will work. just suggestion
- unanchor brick you're 'grabbing' - weld to end of tool to drag it?
are you not ENTERTAINED!??! |
|
|
| Report Abuse |
|
|