I'm marking a obby to where you can teleport half way but my developer products screen gui it prompts the developer products to be bought but after the player buys the dev product nothing happens.... There's a function in the script that should teleport the player by using CFrame of the players Torso.. There's no errors in the dev console...
**Here's my script : **
--[[This script goes inside of a TextBox which should be inside of a ScreenGui]]
productId = 22158084 -- Replace 123123123 with the id of your developer product.
local Player = game.Players.LocalPlayer
script.Parent.MouseEnter:connect(function(Enter)
script.Parent.Style = "RobloxButtonDefault"
script.Parent.Size = UDim2.new(0, 215, 0, 55)
end)
script.Parent.MouseLeave:connect(function(Leave)
script.Parent.Style = "RobloxButton"
script.Parent.Size = UDim2.new(0, 200, 0, 50)
end)
local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
if type(ID) ~= "number" then
return
end
local sets = game:service("InsertService"):GetUserSets(ID)
for k, v in next, sets do
if v.Name == "My Models" then
return v.CreatorName
end
end
end
function giveRewards(player)
print(Player.Name.. 'Bought Dev product')
Player.Character.Torso.CFrame = CFrame.new(-8, 34.5, -52)
return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
giveRewards(UsernameFromID(receiptInfo.PlayerId))
end
script.Parent.MouseButton1Down:connect(function()
game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)
