Hello, I recently got back into Roblox studio and I was updating my Admin commands script because Roblox made some changes while I was away from Roblox. One of the things I was trying to do was update my admin commands script. Basically this admin script has admin commands that owners can use to control the game. One of these commands are a music command. The following would be an excerpt from the script:
if message:sub(1, 6) == "music/ " and Admins[plr.Name] then
local sound = Instance.new("Sound")
sound.Name = "ABACMusic"
sound.Parent = workspace["Music Folder"]
AudioPlayerModule.preloadAudio({
["Sound1"] = message:sub(7)
})
AudioPlayerModule.playAudio("Sound1")
local hint = Instance.new("Hint", workspace)
hint.Name = "Name of Song"
hint.Text = "Playing: "..message:sub(7)
hint:Destroy()
end
This next piece is the code for the volume command:
if message:sub(1,7) == "volume/" and Admins[plr.Name] then
local s = ws["Music Folder"]:FindFirstChild("ABAC")
s.Volume = message:sub(8)
end
Basically when I run the command "music/152233081" it should play music however it does not. And when I run the command "volume/" I get an error like this:
21:14:37.344 - Workspace.ABAC Main:137: attempt to index local 's' (a nil value) 21:14:37.348 - Stack Begin 21:14:37.350 - Script 'Workspace.ABAC Main', Line 137 - global onChatted 21:14:37.353 - Script 'Workspace.ABAC Main', Line 274 21:14:37.355 - Stack End
I am confused as to why this is happening. Could anyone help me fix this script please?
