So here’s the rundown:
This script is in the Gui
local Market = game:GetService("MarketplaceService")
local id = 1306306067
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
Market:PromptProductPurchase(player, id)
end)
This script here is in ServerScriptService
local Market = game:GetService("MarketplaceService")
Market.ProcessReciept = function(reciept)
if reciept.ProductId == 1306306067 then
local player = game.Players:GetPlayerByUserId(reciept.PlayerId)
player:LoadCharacter()
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
And then finally, this here is supposed to respawn the character. (Also in ServerScriptService)
local RS = game:GetService("ReplicatedStorage")
local Plrs = game:GetService("Players")
local ScreenGui = RS:WaitForChild("ScreenGui")
local function PlayerDied(Plr)
local PlrGui = Plr:WaitForChild("PlayerGui")
local UIClone = ScreenGui:Clone()
UIClone.Parent = PlrGui
Plrs.CharacterAutoLoads = false -- Keep in mind that this will toggle for EVERY player in the server
end
local function PlayerAdded(Plr)
Plr.CharacterAdded:Connect(function(Char)
local Hum = Char:WaitForChild("Humanoid")
Hum.Died:Connect(function()
PlayerDied(Plr)
end)
end)
end
Plrs.PlayerAdded:Connect(PlayerAdded)
So the last script somebody posted on the forum because the last script I used had too many problems. My game allows for the purchase but nothing happens.