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.
--ServerScript
game.ReplicatedStorage.DanceAudio.OnServerEvent:connect(function(player, func, loc)
if func == "Start" then
local apple = player.Character:FindFirstChild(loc)
apple.dancepart.SongLoop:Start()
end
if func == "Stop" then
if player.Character:FindFirstChild(loc) then
local apple1 = player.Character:FindFirstChild(loc)
apple1.dancepart.SongLoop:Stop()
else
local apple2 = player.Backpack:FindFirstChild(loc)
apple2.dancepart.SongLoop:Stop()
end
end
end)
My local script
--LocalScript
game.ReplicatedStorage.DanceAudio:FireServer("Start", script.Parent.Name)
Any help is appreciated!

2 comments
bad code
How was this bad code?