Net Message Not Sending

Hello, so I’m making a addon, but I need to send a string from serverside to clientside with net messages, but the addon won’t even give an error or anything.



if SERVER then

util.AddNetworkString("YoutubeMSG")

hook.Add( "PlayerSay", "PlayerSayExample", function( ply, text, team )
	if ( string.sub( text, 1, 8 ) == "/playnow" ) then
	
	local DankMemes = string.sub( text, 9 )
	
	net.Start("YoutubeMSG")
	net.WriteString(string.sub(text, 9))
	net.Send( ply )
	
		return "Now Playing: " .. string.sub( text, 9 )
	end
end)

else

net.Receive( "YoutubeMSG", function( len, ply )
	if ( IsValid( pl ) and pl:IsPlayer() ) then
frame = vgui.Create( "DFrame" )
frame:SetTitle( "youtube" )
frame:SetSize( ScrW() * 0.75, ScrH() * 0.75 )
frame:Center()
frame:MakePopup()

html = vgui.Create( "HTML", frame )
html:Dock( FILL )
html:OpenURL( net.ReadString() )

else
end
end)

end


and for the love of god sort your shit out
what the actual fuck is your indentation?


if SERVER then
    util.AddNetworkString("YoutubeMSG")

    hook.Add("PlayerSay", "PlayerSayExample", function(ply, text, team)
        if (string.sub(text, 1, 8) == "/playnow") then
            local DankMemes = string.sub(text, 9)
        
            net.Start("YoutubeMSG")
                net.WriteString(DankMemes)
            net.Send(ply)
            
            return "Now Playing: " .. DankMemes
        end
    end)
else
    net.Receive("YoutubeMSG", function(len, ply)
        if (IsValid(ply) and ply:IsPlayer()) then -- this check is useless, ply will always be a valid player.
            local frame = vgui.Create("DFrame")
            frame:SetTitle("youtube")
            frame:SetSize(ScrW() * 0.75, ScrH() * 0.75)
            frame:Center()
            frame:MakePopup()


            local html = vgui.Create("HTML", frame)
            html:Dock(FILL)
            html:OpenURL(net.ReadString())
        end
    end)
end


this is infinitely easier to read than what you have.

Well, even with that the net message for opening the url isn’t being recieved, also It’s not opening the derma frame.

The player argument in the net receive callback will be nil client side (might be NULL can’t check right now), it’s only valid server side to see who the message was sent from.