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 » Scripters
Home Search
 

Re: How to play sounds only in a certain region ?

Previous Thread :: Next Thread 
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
24 Jun 2016 11:34 PM
I was thinking about using Region3 and the GetPartsInRegion3 method but I don't know how to use it.

So, I turn to you scripters, I need your help


Current Rap: #RAP R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
24 Jun 2016 11:37 PM
I mean you could also use magnitude;

local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local brick = workspace:WaitForChild("DistanceBrick")

char.Torso.Changed:connect(function()
if (char.Torso.Position - Brick.Position).magnitude < 10 then
--musicstuff
end
end)
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
24 Jun 2016 11:41 PM
It needs to be a cubed region not a spherical one

correct me if I'm wrong but I think I heard somewhere magnitude is a sphere or something idk


Current Rap: 1,292,955 R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
24 Jun 2016 11:42 PM
What game are you making?
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
24 Jun 2016 11:47 PM
First of all have you played minecraft before? This method is exactly like minecraft, I played the game like loong ago back.

Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) )
-- a Region3 with a size of (8, 8, 8) and a position at (5, 5, 5)

It says in the wiki that's how you exactly do it. I've never really used this method before, but I think it goes something like this;

if char.Torso.Position = Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ) then
end


Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
24 Jun 2016 11:47 PM
* == common mistake.
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
24 Jun 2016 11:50 PM
From a logical point of view, it sounds like you're inserting an invisible cube into workspace at a certain position. Then when a player walks into the area of the cube, you can create a statement checking if the player is in the cube.
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:00 AM
Updating an older game of mine

I used teleports to change the music but now I'm going to use something else to make it more efficient

it's an obby


Current Rap: 1,292,123 R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:02 AM
You can do something like this, to make it fade when it changes;

for i = 1,0,-0.05 do
sound.Valume = i
wait()
end
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:02 AM
Thanks for you help Lemon

but in this: Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) )


how are you setting the position of the invisible cube?


Current Rap: 1,290,912 R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:02 AM
*Volume, my mistake.
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
25 Jun 2016 12:03 AM
laakari, 1,1,1 and 9,9,9 is the position.


r+://393244197r+://393244224r+://393244262
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:03 AM
The second vector3 is the position I believe.
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:05 AM
I need to be able to position the invisible cube?


Current Rap: 1,290,900 R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:05 AM
Oh yeah now that I think about it, I think it's using 3D calculations to detect the size using from start, to end point.
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:06 AM
OH (1,1,1) is the first position

and (8,8,8) is the second position

thus creating a region inside of it

got it thanks


Current Rap: 1,290,900 R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:07 AM
I think 1,1,1 is the size correct me if I'm wrong, and 9,9,9 is the position.
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:08 AM
Yeah or that, that could possibly be the logical solution.
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:08 AM
Last question I believe

if char.Torso.Position = Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ) then





^ The position isn't referring to one position right? It's every possible position inside the region?


Current Rap: 1,290,900 R$
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
25 Jun 2016 12:09 AM
try it


r+://393244197r+://393244224r+://393244262
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:09 AM
Yeah I think it's like saying

for i = 1,6 you know? Like 1, 6.
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:12 AM
Can I set a name to the region?


Current Rap: 1,289,628 R$
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
25 Jun 2016 12:13 AM
its not an instance, so i dont think so


r+://393244197r+://393244224r+://393244262
Report Abuse
Laakari is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
25 Jun 2016 12:14 AM
If I wanted multiple regions for multiple areas?


Current Rap: 1,289,628 R$
Report Abuse
Lem0nzzx is not online. Lem0nzzx
Joined: 08 Feb 2016
Total Posts: 1604
25 Jun 2016 12:15 AM
You could just add 'or', then add more Region3.new's to the statement.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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