I have some game passes in my game. I have a local script which checks if the player has the gamepass. If they do, then the local script makes the text button visible.
Here is the local script (inside text button):
local Player = game.Players.LocalPlayer
local WalkSpeedId = My GamePass Id
local MarketPlaceService = game:GetService("MarketplaceService")
if MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, WalkSpeedId) then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
Is this a good way to do it? Can hackers change this so that even if they don't have the gamepass, they can still make the gui visible? Can I use remote events here? If yes, then how.
Any help would be appreciated.

2 comments
Hackers can make the GUI visible no matter what. Remember, Filtering Enabled is not in place to prevent hacking. It exists to prevent hackers' actions from replicating to the rest of the server. So yeah, anybody can go into your game and make that GUI visible with a simple injector. It's what you allow them to do when they have that GUI open that's important
If you were really worried about this GUI in particular, it could be stored somewhere inaccessible to the client, like ServerStorage, and you could use a RemoteFunction to request it. This basically just serves as a buffer. The idea is that the more obscure parameters for your remotes that you have, the harder it would be for an exploiter to figure out the parameters