Why can't I locate the audio part?
Asked by
5 years ago Edited 5 years ago
So what I'm trying to do is make this audio play for everyone in the server, so I used a remove event.
I ran into this:
I'm trying to access this audio part by a variable name, using a remote event. It's says the variable 'apple', 'apple1', and 'apple2' are nil values.
02 | game.ReplicatedStorage.DanceAudio.OnServerEvent:connect( function (player, func, loc) |
03 | if func = = "Start" then |
04 | local apple = player.Character:FindFirstChild(loc) |
05 | apple.dancepart.SongLoop:Start() |
07 | if func = = "Stop" then |
08 | if player.Character:FindFirstChild(loc) then |
09 | local apple 1 = player.Character:FindFirstChild(loc) |
10 | apple 1. dancepart.SongLoop:Stop() |
12 | local apple 2 = player.Backpack:FindFirstChild(loc) |
13 | apple 2. dancepart.SongLoop:Stop() |
My local script
2 | game.ReplicatedStorage.DanceAudio:FireServer( "Start" , script.Parent.Name) |
Any help is appreciated!