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: How do I check if someone is standing on a brick?

Previous Thread :: Next Thread 
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
06 Aug 2011 09:14 PM
Example: The fencing place (I think it was like stickmasterluke or someone) where you only fight when your standing on a certain brick.

.:/!#sckum#!\:.
Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:21 PM
It's not a certain block, but area. See, you would have to get the vectors between two points. Point A and Point B, then you would have to use an if that would check if the player is in that area. So you would have to collect a lot of data. This is how i suppose you could approach it.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Aug 2011 09:21 PM
he just checks if their X and Y position of their torso are inside the squares dimensions. Fairly simple actually.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Aug 2011 09:22 PM
Also now that we have Region3, you don't even have to use any math.
Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:23 PM
@Sduke Last time i checked, that function was deprecated or w/e it is. I'll check again if you say its good enough to use.
Report Abuse
Joalmo is not online. Joalmo
Joined: 28 Jun 2009
Total Posts: 1160
06 Aug 2011 09:24 PM
part that lets you fight:


------------------
function onTouch(hit)

(code that gives you weapons, etc)

end

script.Parent.Touched:connect(onTouched)

------------------

and then you can make another part that takes away all the weapons so they can't fight while standing on the block like this:

------------------

function onTouched(hit)

(code that takes away weapons etc)

end

script.Parent.Touched:connect(onTouched)

------------------


That's how I would do it

Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:27 PM
@Joalmo

Sadly its not that simple, If you really wanted to do it that way, you could store a value and then check to see if the value is true, then in another script on another block, set it to false, and on the main block, set it to true. That would be not sufficient though.
Report Abuse
Joalmo is not online. Joalmo
Joined: 28 Jun 2009
Total Posts: 1160
06 Aug 2011 09:29 PM
Not to act noobish or anything, but why wouldn't it?
Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:32 PM
Because, The way you are trying to process if someone is in the area or not, is a lot slower than just checking if they are in a certain area. Plus it is only activated when they character steps on the brick, and most of the time, things that are on touch break. So therefore you have two problems built into one.
Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:35 PM
EDIT:


Plus you can just incorporate the area check into the weapons script, so you only have to distribute the weapon once. Therefore it saves a lot of glitching if anything happens.
Report Abuse
Joalmo is not online. Joalmo
Joined: 28 Jun 2009
Total Posts: 1160
06 Aug 2011 09:37 PM
Oh okay.
Report Abuse
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
06 Aug 2011 09:39 PM
So how would I use Region3?

.:/!#sckum#!\:.
Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:42 PM
Well, i dont really know ATM. I am figuring this out now, sorry.
Report Abuse
Miksterman is not online. Miksterman
Joined: 28 Dec 2008
Total Posts: 397
06 Aug 2011 09:44 PM
Region3 is not depricated. It is actually fairly new(ish).
You use is something like this...

Region = Region3.new(Vector3, Vector3)

Parts = game.Workspace:GetPartsInRegion3(Region[, Model/Parts to ignore])
for i,v in pairs(Parts) do
print(i,v)
end
Report Abuse
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
06 Aug 2011 09:47 PM
Region = Region3.new(Vector3, Vector3)

Parts = game.Workspace:GetPartsInRegion3(Region[, Model/Parts to ignore])

if Parts.Name = brick then
print("does this work?")
end


does that work?



.:/!#sckum#!\:.
Report Abuse
lukenuke75 is not online. lukenuke75
Joined: 26 Jul 2008
Total Posts: 423
06 Aug 2011 09:48 PM
Just started scripting in RBLX Lua again.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
07 Aug 2011 12:21 AM
WHY DOES EVERYONE WANT TO KNOW ABOUT STICKMASTERLUKES FENCING GAME!!!!!
Just use a forcefield for the parts that you dont wanan humanoid to get killed by
Report Abuse
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
07 Aug 2011 12:23 AM
Because it is a mystery.

.:/!#sckum#!\:.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
07 Aug 2011 12:26 AM
No, seriously just use forcefields everywhere exept the part where you don't want a player to get killed
Report Abuse
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
07 Aug 2011 12:33 AM
How would that work......

.:/!#sckum#!\:.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
07 Aug 2011 12:36 AM
Because a forcefield is an instance that whereever you put it a player can't kill a player.I dont know the address but maybe type roblox wiki Instance forcefield
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
07 Aug 2011 12:38 AM
Using math would be a lot simpler

function overBrick(base,part)
local pc=part.CFrame.p;
local bc=base.CFrame.p;
local bs=base.Size;
return ((pc.x< bc.x+bs.x/2 and pc.x>bc.x-bs.x) and
(pc.z< bc.z+bs.z/2 and pc.z>bc.z-bs.z) and pc.y>bc.y)
end

overBrick(base,player_torso)
Report Abuse
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
07 Aug 2011 12:38 AM
Thats not true it just makes a player invisible if its in the same model as the torso.

.:/!#sckum#!\:.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
07 Aug 2011 12:55 AM
Look at objects in roblox wiki and find forcefield.
Report Abuse
sckum555 is not online. sckum555
Joined: 20 Aug 2008
Total Posts: 6576
07 Aug 2011 01:01 AM
I did.

.:/!#sckum#!\:.
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