StudioService can only supposely be used in Roblox Studio, GameScripts cannot run such because they lack permission so you have to run it in a plugin, roblox studio commandbar and/or such.
Example:
GameScript:
01:20:32.429 > printidentity() - Studio
01:20:32.429 Current identity is 2 - Studio
01:20:34.479 > print(game:GetService("StudioService"):GetUserId()) - Studio
01:20:34.480 print(game:GetService("StudioService"):GetUserId()):1: attempt to index nil with 'GetUserId' - Edit
01:20:34.480 Stack Begin - Studio
01:20:34.480 Script 'print(game:GetService("StudioService"):GetUserId())', Line 1 - Studio
01:20:34.480 Stack End - Studio
Commandbar/Plugin/ElevatedStudioPlugin:
01:20:47.721 > printidentity() - Studio
01:20:47.721 Current identity is 6 - Studio
01:20:49.125 > print(game:GetService("StudioService"):GetUserId()) - Studio
01:20:49.126 684075566 - Edit