Hey there! I was attempting to make a proximity prompt that teleports the player to a new location if they own a certain gamepass. If the player doesn’t own the gamepass, it’ll prompt a purchase. The problem I’m experiencing is: The prompted purchase says "the item is not for sale."
Here’s the code I have so far:
local TeleBrick2 = script.Parent.Parent.Parent.Parent.Enter
local ProximityPrompt = script.Parent
local Id = 45168025
local VipPlayers = {}
local function FindPlayer(Plr)
for Num, Pler in pairs(VipPlayers) do
if Pler == Plr then
return true
end
end
end
ProximityPrompt.Triggered:Connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, Id) or FindPlayer(player.Name) then
player.Character.Humanoid.WalkSpeed = 0
ProximityPrompt.Enabled = false
local gui = Instance.new("ScreenGui", player.PlayerGui)
local label = Instance.new("TextLabel", gui)
label.Size = UDim2.new(2, 0, 2, 0)
label.Position = UDim2.new(-0.5, 0, -0.5, 0)
label.BackgroundColor3 = Color3.new(0,0,0)
label.BackgroundTransparency = 1
label.Text = ""
while gui and label and label.BackgroundTransparency > 0 do
wait()
label.BackgroundTransparency = label.BackgroundTransparency - 0.01
end
player.Character.HumanoidRootPart.Position = script.Parent.Parent.Parent.Parent.Brick1_2.Position
while gui and label and label.BackgroundTransparency < 1 do
wait()
label.BackgroundTransparency = label.BackgroundTransparency + 0.01
end
if gui then
gui:Remove()
end
player.Character.Humanoid.WalkSpeed = 14.5
ProximityPrompt.Enabled = true
end
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, Id) == false then
game:GetService("MarketplaceService"):PromptPurchase(player, Id)
end
end)