#Teleportation after buying a dev product not working

1 messages · Page 1 of 1 (latest)

floral ember
#

.

#

in my game, if i were to click a certain text button, a dev product popped up for me to buy, if i bought it then it would teleport me on top of a part called " End Part ", it worked yesterday but today it decided not to work </3. here is the script in server script service

#

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local productId = 3562278469 -- your Developer Product ID

-- Wait for Level 8 to exist
local level8 = workspace:WaitForChild("Level 8")

-- Function to recursively find EndPart inside Level 8
local function findEndPart()
for _, descendant in ipairs(level8:GetDescendants()) do
if descendant:IsA("BasePart") and descendant.Name == "EndPart" then
return descendant
end
end
return nil
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end

if receiptInfo.ProductId == productId then
    local character = player.Character or player.CharacterAdded:Wait()

    -- Wait until HumanoidRootPart exists
    local hrp = character:WaitForChild("HumanoidRootPart", 10)
    if not hrp then
        warn("HumanoidRootPart not found, cannot teleport!")
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end

    local endPart = findEndPart()
    if endPart then
        -- Teleport 5 studs above the EndPart
        hrp.CFrame = endPart.CFrame + Vector3.new(0,5,0)
        print("Teleported player to EndPart!")
    else
        warn("EndPart not found inside Level 8!")
    end
end

return Enum.ProductPurchaseDecision.PurchaseGranted

end

#

and yes i did use gpt

tepid shuttle
floral ember
tepid shuttle
wind fog