How do I turn AppleTalk on or off??

I’m trying to make a script which turns AppleTalk off or on, but I can’t get to it
does anyone know how to do it

tell application "Finder"
	activate
end tell

tell application "System Events"
	tell application "System Preferences"
		activate
		set current pane to pane "com.apple.preference.Network"
	
	end tell
end tell
tell application "system events"
tell process "system preferences"
activate
set current pane to pane com.apple.preference.network
set appletalk to true (or false depending which you want to do)
end process
end tell

Ok firstly, you don’t need the tell app finder stuff up top. you only need that if finder is quit, in which case it automatically relaunches itself anyway. secondly, the tell “system preferences” should be process not application. if you didn’t have t tell “system events” then it would be a application but since “system events” is going, its a process of that.