local Gamepass = 1249117
local Player = game.Players.LocalPlayer
function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if game.MarketplaceService:PlayerOwnsAsset(Player,Gamepass) then game.ServerStorage.Ask:Clone().Parent = game.Players.LocalPlayer.PlayerGui end end script.Parent:connect(onTouched)
For future reference, it makes your code much easier to read if you use the codeblock feature and properly indent and separate your code.
Game Passes work differently than other assets now and you need to use the new API for new game passes.
You'd pass in a call like this:
MarketplaceService:UserOwnsGamePassAsync(LocalPlayer.UserId, GamePassId)
.
Additionally, the client cannot access game.ServerStorage
.
You are checking if any part with a humanoid touched the part, but that's not what you want, because other NPCs or players could touch the part.
For future reference, just call game.Players:GetPlayerFromCharacter(TouchedPart.Parent)
to attempt to find the player (though it can be nil
, so return if it is). Use either that or the Humanoid.Touched
event for this, and make sure that you only listen for the local player touching the part.
RBXScriptSignal:connect()
is deprecated, prefer RBXScriptSignal:Connect()
.
ok so i did
local Gamepass = 1249117 local Player = game.Players.LocalPlayer function onTouched(m) p = m.Parent:findFirstChild("Humanoid") if game.MarketplaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId, Gamepass) then print("Player Has Gamepass") end end script.Parent:Connect(onTouched)
still is not working did i miss something you said?