local Main = script.Parent
local Players = game:GetService("Players")
local oGUI = script:FindFirstChild('ScreenGui')
Main.Touched:Connect(function(Hit)
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
local PlayerGui = Player.PlayerGui
if oGUI and Player then
Main.Sound:Play()
for n = 0 , 2 , 0.2 do
Main.Sound.Volume = n
print('Hi!')
local GUI = oGUI:Clone()
GUI.Parent = PlayerGui
wait(3)
GUI:Destroy()
for y = 2 , 0 , 0.2 do
Main.Sound.Volume = y
wait(0)
Main.Sound.Volume:Stop()
end
end
end
end)
I'm trying to make a thing where if you touch it a GUI pops up and it plays a song PS : script is a server script

2 comments
Can you tell us what is going wrong? What is happening that you don't want? And do you get any errors?
Testing it again there was an error , 10:59:53.284 - Workspace.Part.Script:8: attempt to index local 'Player' (a nil value)