HeidiNZv2
|
  |
| Joined: 01 Oct 2014 |
| Total Posts: 48 |
|
|
| 06 Oct 2016 04:08 AM |
is there any particular way I would be able to make it so that when I enter an area, a different audio starts, and when I exit that area into another one, another music plays? This would be really helpful for my RPG if it were possible. I'm a 567% newbie to scripting and if you tried to explain to me how to do something I probably wouldn't understand, so if you could post a code and what to do with it, I would greatly appreciate it
If this isn't possible thank you for reading and possibly trying to help. |
|
|
| Report Abuse |
|
|
taxijack
|
  |
| Joined: 21 Nov 2013 |
| Total Posts: 469 |
|
|
| 06 Oct 2016 04:27 AM |
| Yes it is possible let me just get the script code |
|
|
| Report Abuse |
|
|
taxijack
|
  |
| Joined: 21 Nov 2013 |
| Total Posts: 469 |
|
|
| 06 Oct 2016 04:30 AM |
local brick = script.Parent local sound = script.Parent.Sound
brick.Touched:connect(function(hit) player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then play = sound:Clone() play.Parent = player.PlayerGui play:Play() end end)
|
|
|
| Report Abuse |
|
|
taxijack
|
  |
| Joined: 21 Nov 2013 |
| Total Posts: 469 |
|
|
| 06 Oct 2016 04:32 AM |
| Make a part and rename it brick and then move the script and the music into the part make sure the music is called sound |
|
|
| Report Abuse |
|
|
Aliics
|
  |
| Joined: 29 Sep 2014 |
| Total Posts: 471 |
|
|
| 06 Oct 2016 06:55 AM |
| That's... fairly inefficient. It would be better to use magnitude to check if the player is in an area. local player = game.Players.LocalPlayer local char = player.Character local area = game.Workspace['area'] if (char.Torso.Position - area.Position).magnitude < 200 then --if you're 200 studs from ###### ###### for sound end |
|
|
| Report Abuse |
|
|
kakaghiti
|
  |
| Joined: 31 Oct 2010 |
| Total Posts: 39 |
|
|
| 06 Oct 2016 09:55 AM |
| Could you put this in script terms? I mean in rows rather than one big sentence. Thanks. |
|
|
| Report Abuse |
|
|
| |
|