I am trying to get this script to prompt a purchase to the gamepass if they don't own it, but if they do then it puts the tools in the locations shown below. I keep getting this error though and I don't know what to do to fix this, any help?
local GamePassService = game:GetService("MarketplaceService") local GamepassId = 0 -- 0 for purpose of asking script.Parent.Touched:Connect(function(hit) if GamePassService:UserOwnsGamePassAsync(player.UserId, GamepassId) then game.ServerStorage.FlyingCarpet:Clone().Parent = player.Backpack game.ServerStorage.FlyingCarpet:Clone().Parent = player.StarterGear end end)
Script doesnt know what player is so type this under function
local player = game.Players:GetPlayerFromCharacter(hit.Parent)