What im Trying to Achieve : Music only supposed to play in a certain area and the Music is the Sound ID provided by the Player in the TextBox but it dosent eem to be working
game.Players.PlayerAdded:Connect(function(plr)
local Music = script.Parent.Music
local Area = script.Parent
local Main = plr.PlayerGui:WaitForChild(“Main”)
local Slot7 = Main.Frame.Slot7
local Text = Slot7.Text
Music.SoundId = Text
Hi,
1)Please avoid using wait, it can cause some errors/issues sometimes. I’d recommend using task.wait or runservice instead. They’re better and more efficient.
2)You can use a remote function [if you want the server to be affected from this], and then invoke it , and when the player has entered that specific area, that music will be playing.
If you want it to be playing only for him, you can either fire/invoke a remote, and from there, you could fire that client all you need [ so in that way, it’d be affected only on him, but from the server, which is always preferred].
For this, you should use ZonePlus. Whenever a player enters the zone, you can find their PlayerGui, find the ScreenGui, find the Frame, find the Sound, and play it. Whenever the player leaves the zone, you can stop the sound. You can find the API for ZonePlus here: Introduction - ZonePlus