When I open the Local File for my game, all my scripts work just fine. However, the exact same scripts do not work on my Public game file.
Local Script:
local ID = 1220156317
local Player = game:GetService('Players').LocalPlayer
local MarketplaceService = game:GetService('MarketplaceService')
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(Player,ID)
print("Sending server side event to sanity check...")
end)
Server Script:
local Handlers = {};
local expPart = game.Workspace.Nuke.ExplosionPart
Handlers[1220156317] = function(Receipt, Player)
print("Sanity check received; player is granted access.")
wait(1)
print("Nuke launched.")
game.Workspace.TopRain.Parent = game.ReplicatedStorage
game.Workspace.Nuke.Explosion.TimePosition = 0
game.Workspace.Nuke.Siren.TimePosition = 0
game.Workspace.RainSounds.Playing = false
game.Workspace.Music.Playing = false
game.Workspace.Nuke.Siren.Playing = true
wait(5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(50,30,30)
game.Lighting.FogColor = Color3.fromRGB(50,30,30)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(57,27,27)
game.Lighting.FogColor = Color3.fromRGB(57,27,27)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(63,24,24)
game.Lighting.FogColor = Color3.fromRGB(63,24,24)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(75,19,19)
game.Lighting.FogColor = Color3.fromRGB(75,19,19)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(85,15,15)
game.Lighting.FogColor = Color3.fromRGB(85,15,15)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(95,12,12)
game.Lighting.FogColor = Color3.fromRGB(95,12,12)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(110,9,9)
game.Lighting.FogColor = Color3.fromRGB(110,9,9)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(130,4,4)
game.Lighting.FogColor = Color3.fromRGB(130,4,4)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(150,0,0)
game.Lighting.FogColor = Color3.fromRGB(150,0,0)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(180,0,0)
game.Lighting.FogColor = Color3.fromRGB(180,0,0)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(210,0,0)
game.Lighting.FogColor = Color3.fromRGB(210,0,0)
wait(0.5)
game.Lighting.OutdoorAmbient = Color3.fromRGB(255,0,0)
game.Lighting.FogColor = Color3.fromRGB(255,0,0)
wait(5)
game.Workspace.Nuke.Explosion.Playing = true
wait(0.3)
for i, v in pairs (game:GetService("Players"):GetPlayers()) do
v.Character:FindFirstChild("Humanoid").Health = 0
local function explode()
local explosion = Instance.new('Explosion')
explosion.Position = expPart.Position
explosion.BlastRadius = 10000000
explosion.Visible = false
explosion.Parent = game.Workspace.Nuke.ExplosionPart
end
explode()
end
game.Players.RespawnTime = 15
wait(5)
game.Workspace.Nuke.Explosion.Playing = false
wait(10)
game.ReplicatedStorage.TopRain.Parent = game.Workspace
game.Workspace.Nuke.Siren.Playing = false
game.Workspace.RainSounds.Playing = true
game.Workspace.Music.Playing = true
game.Players.RespawnTime = 0.5
game.Lighting.OutdoorAmbient = Color3.fromRGB(0,0,0)
game.Lighting.FogColor = Color3.fromRGB(39,40,47)
end;
function ProcessReceipt(p1)
local p2 = false
local p3, p4 = pcall(function()
end)
if p3 and p4 then
return Enum.ProductPurchaseDecision.PurchaseGranted;
else
end;
local p5 = game.Players:GetPlayerByUserId(p1.PlayerId);
if not p5 then
return Enum.ProductPurchaseDecision.NotProcessedYet;
end;
local handler = Handlers[p1.ProductId];
local p6, p7 = pcall(handler, p1,p5)
if not p6 or not p7 then
return Enum.ProductPurchaseDecision.NotProcessedYet;
end;
local p3, p4 = pcall(function()
end)
if not p3 then
end;
return Enum.ProductPurchaseDecision.PurchaseGranted;
end;
game:GetService("MarketplaceService").ProcessReceipt = ProcessReceipt;
(Sorry for the very messy scripts)
In summary, when I test the game it works. However, when someone purchases it in-game it does not work.
Thanks!