So this music script is supposed to only play music in specific parts of my game. In Test or studio mode it works perfectly nothing goes wrong. However when I join a server for my Game it doesn't do anything. I checked my dev console's server log and I get the error "Workspace is not a valid member of players" Does this mean I wrote Workspace is in Players in the script? I honestly have no clue why it's not working. What did i do wrong?
Theres 2 scripts and I will show both of them but Im pretty sure the problem lies in the first one.
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Players[hit.Parent.Name].PlayerGui.Song2.Volume = 1
game.Players[hit.Parent.Name].PlayerGui.Song1:stop()
game.Players[hit.Parent.Name].PlayerGui.Song2:play()
end
end)
script.Parent.TouchEnded:connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
game.Players[hit.Parent.Name].PlayerGui.Song2.Volume = 0
end
end)
