Table.insert(whiteList,char) -Adding the character to the white list Player.CharacterAdded:Connect(function(char) -Fires when the character is added :Connect(function(player) -Fires when the player is added Local event = game.ReplicatedStorage:FindFirstChild('MusicEvent') -Defining event Instance.new("RemoteEvent",game.ReplicatedStorage).Name = 'MusicEvent' If not(game.ReplicatedStorage:FindFirstChild('MusicEvent')) then -Checks if there is an event, otherwise it creates one Source code local whiteList = - Whitelist for zone Or copy the source code and copy the setup You can download the place here MusicPlaying.rbxl (21.1 KB) I made the zones not fully transparent so you could see them Ok, here is the code I created, I have created notes so you can take this and maybe modify it to your needs Place a localscript in StarterPlayerScripts (under StarterPlayer in explorer) and make this the code: :Connect(function() Now the game detects when the player crosses into the 2nd room. Local target = players:GetPlayerFromCharacter(char) Local humanoid = part.Parent:FindFirstChild("Humanoid") You’re going to want to set the code in the script to this: local players = game:GetService("Players") Make it’s transparency 1, CanCollide false, and make sure that players can’t accidentally pass by it without touching it. From here, insert a brick where the first room meets the 2nd room, so when they cross into the 2nd room they touch the brick. Now add a RemoteEvent into ReplicatedStorage. Name one sound “Sound1” and the other one for Room 2 “Sound2”. The first thing you’re going to want to do is to add your sounds into SoundService. I’ll try my best, I’ve never been a great teacher.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |