I'm trying to make a "Skip Stage" in my Obby, but my output says
"invalid argument #1 to 'sub' (string expected, got Instance)"
The code:
local MarketplaceService = game:GetService("MarketplaceService")--The Service
local Players = game:GetService("Players")--More Services
local productID = 1083524533--Product ID
local function promptPurchase()--The function
local player = Players.LocalPlayer--The Player
MarketplaceService:PromptProductPurchase(player, productID)--Prompt it
MarketplaceService.PromptProductPurchaseFinished:connect(function()--When it's done
local stage = script.Parent.Parent.Parent.Parent.Parent.Team--The Team(From Alvin_Blox)
print(string.sub(stage,6,7))--this doesn't work
end)--end
end--end
script.Parent.MouseButton1Click:Connect(promptPurchase)--Connect it
I got the script from the Developer Hub, The PromptProductPurchaseFinished from the Developer Forum, the Teams Stuff from Alvin_Blox, and the string.sub from Scripting Helpers.
Edit: I'm just testing it but the real problem is so it will teleport a player to the next spawn location's position.

2 comments
https://developer.roblox.com/en-us/api-reference/lua-docs/string
I checked that already. I also tried gsub with numbers but It still doesn't work...