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: Is there a way to get if the player is still standing on a brick?

Previous Thread :: Next Thread 
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
30 Sep 2011 01:27 PM
[ Content Deleted ]
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
30 Sep 2011 01:29 PM
[ Content Deleted ]
Report Abuse
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
30 Sep 2011 01:31 PM
[ Content Deleted ]
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
30 Sep 2011 01:34 PM
Just check if the magnitude is 1
Report Abuse
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
30 Sep 2011 01:35 PM
[ Content Deleted ]
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
30 Sep 2011 01:37 PM
Oh wow thanks :P I misread it sorry.

It depends on the size of the brick. So I think you can use it like this:

if (BRICK.Position - CHAR.Torso.Position).magnitude == (BRICK.Size).unit then
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
30 Sep 2011 01:42 PM
Use less than, rather than equal to. Also, you would do a magnitude of half of the largest axis.
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
30 Sep 2011 01:43 PM
Jeez, I'm rusty today.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
30 Sep 2011 02:01 PM
It's not as simple as that, either.


function checkIfPlayerTouching(player, brick)
local pPos = player.Character~=nil and player.Character.Torso.Position
local bPos = brick.Position
local bSize = brick.Size
-- Here's where it gets complicated!
if math.abs(pPos.x-bPos.x)<(bSize.x/2+1) and math.abs(pPos.z-bPos.z)<(bSize.z/2+1) and (pPos.y-bPos.y)<=(bSize.y/2+3) then

-- player is in contact with brick

end
end
Report Abuse
Swordphin123 is not online. Swordphin123
Joined: 09 Apr 2008
Total Posts: 5234
30 Sep 2011 03:14 PM
My friend created something like this:

http://www.roblox.com/While-Touched-Button-V1-0-item?id=35740461
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