What it should do is fire a remote when the click detector is clicked, the click detector then makes sure the player has the gamepass and if they don't it prompts the purchase for it. Then the local script, when the remote is run will check again if the player has the gamepass(to stop exploiters from just firing the remote) But I get this error on line 11 of the server script:
12:08:15.831 - Unable to cast Instance to int64
Server:
local this = script.Parent
local CL = script.Parent.CL
local mp = game:GetService("GamePassService")
local remote = game.Lighting.OD
local mp2 = game:GetService("MarketplaceService")
CL.MouseClick:Connect(function(plr)
if mp:PlayerHasPass(plr,5043985) then
remote:FireClient(plr)
else
mp2:PromptGamePassPurchase(5043985,plr)
end
end)
Local:
local plr = game.Players.LocalPlayer
local mp = game:GetService("GamePassService")
game.Lighting.OD.OnClientEvent:Connect(function()
if mp:PlayerHasPass(plr,5043985) then
game.Lobby.VIPPART:Destroy()
end
end)

2 comments
u shouldnt put it in lighting put it in replicated storage
^