I have 2 problems with this script one in line 3 and the other in line 5. The error for line 3 is "workspace.Part.MusicScript1:3:attempt to index field parent (a nil value)" in line 5 it's "workspace.Part.MusicScript1:5:attempt to index field player (a nil value)"
What do these 2 errors mean and how do I fix them?
Here is the full script-
script.Parent.Touched:Connect(function(hit)
wait(1)
if hit.Parent:FindFirstChild('Humanoid') then
local player = game:GetService('Players'):GetPlayerFromCharacter(hit.Parent)
local playergui = player:WaitForChild('PlayerGui')
local Song1 = playergui:WaitForChild('Song1')
local Song2 = playergui:WaitForChild('Song2')
Song1.Volume = 1
Song2:Stop()
Song1:Play()
end
end)
Also the Audio the script is trying to play is in StarterGui and the script will work in test mode but not in game.

3 comments
On line 5 try doing: "local player = game:GetService("Players"):FindFirstChild(hit.Parent.Name)"
GetPlayerFromCharacter is recommended and more reliable that than method Mizery. What is script.Parent TheFirstPire?
The scripts parent is a Part. Also im still very new to scripting so what would I change to GetPlayerFromCharacter?