You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want it where when i buy the product everytime i join the game it well freezer all the players kills all the players in blind all the players when you buy thos product - What is the issue? Include screenshots / videos if possible!
when I try to buy freeze all or any other product in the script it sometims don’t work when you join the game when you buy it in sometimes when you join the game it well work - What solutions have you tried so far? Did you look for solutions on the Creator Hub?
i try added plr.Character:Wait() to see if it was an issue loading the Character
hers the client script
local BlindAll = script.Parent.Frame.ScrollingFrame.BlindAll:WaitForChild("TextButton")
local FreezeAll = script.Parent.Frame.ScrollingFrame.FreezeAll:WaitForChild("TextButton")
local ScareAll = script.Parent.Frame.ScrollingFrame.ScareAll:WaitForChild("TextButton")
local KillAll = script.Parent.Frame.ScrollingFrame.KillAll:WaitForChild("TextButton")
local StealAll = script.Parent.Frame.ScrollingFrame.StealAll:WaitForChild("TextButton")
local MarketplaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local BlindAllProductId = 3412115283
local FreezeAllProductId = 3412115582
local ScareAllProductId = 3412116121
local KillAllProductId = 3412116945
local StealAllProductId = 3412117199
BlindAll.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, BlindAllProductId)
end)
FreezeAll.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, FreezeAllProductId)
end)
ScareAll.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, ScareAllProductId)
end)
KillAll.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, KillAllProductId)
end)
StealAll.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, StealAllProductId)
end)
and hers the server script
local MarketplaceService = game:GetService("MarketplaceService")
local Player = game:GetService("Players")
local BlindAllProductId = 3412115283
local FreezeAllProductId = 3412115582
local ScareAllProductId = 3412116121
local KillAllProductId = 3412116945
local StealAllProductId = 3412117199
local function addBlindScreen(plr)
local playerGui = plr:FindFirstChild("PlayerGui") or plr:WaitForChild("PlayerGui", 10)
if not playerGui then return end
if not playerGui:FindFirstChild("BlindEffect") then
local blindScreen = Instance.new("ScreenGui")
blindScreen.Name = "BlindEffect"
blindScreen.ResetOnSpawn = false
blindScreen.IgnoreGuiInset = true
blindScreen.Parent = playerGui
local frame = Instance.new("Frame")
frame.Size = UDim2.new(1, 0, 1, 0)
frame.Position = UDim2.new(0, 0, 0, 0)
frame.BackgroundColor3 = Color3.new(0, 0, 0)
frame.BackgroundTransparency = 0
frame.BorderSizePixel = 0
frame.Parent = blindScreen
end
end
local function blindAllPlayers(buyer)
for _, plr in ipairs(Player:GetPlayers()) do
if plr ~= buyer then
addBlindScreen(plr)
end
end
task.delay(60, function()
for _, plr in ipairs(Player:GetPlayers()) do
if plr ~= buyer then
local playerGui = plr:FindFirstChild("PlayerGui")
if playerGui then
local blindScreen = playerGui:FindFirstChild("BlindEffect")
if blindScreen then
blindScreen:Destroy()
end
end
end
end
end)
end
local function freezeAllPlayers(buyer)
local frozenParts = {}
for _, plr in ipairs(Player:GetPlayers()) do
if plr ~= buyer then
local character = plr.Character or plr.Character:Wait()
local root = character:FindFirstChild("HumanoidRootPart")
if root then
frozenParts[plr] = root
root.Anchored = true
end
end
end
print("All players frozen for 60 seconds")
task.delay(60, function()
for _, plr in ipairs(Player:GetPlayers()) do
local root = frozenParts[plr]
if root and root.Parent then
root.Anchored = false
end
end
print("All players unfrozen")
end)
end
local function addScareScreen(plr)
local playerGui = plr:FindFirstChild("PlayerGui") or plr:WaitForChild("PlayerGui", 10)
if not playerGui then return end
local char = plr.Character or plr.CharacterAdded:Wait()
if not char then return end
local old = playerGui:FindFirstChild("ScareEffect")
if old then old:Destroy() end
local scareGui = Instance.new("ScreenGui")
scareGui.Name = "ScareEffect"
scareGui.ResetOnSpawn = false
scareGui.IgnoreGuiInset = true
scareGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
scareGui.Parent = playerGui
local img = Instance.new("ImageLabel")
img.Size = UDim2.new(1, 0, 1, 0)
img.Position = UDim2.new(0, 0, 0, 0)
img.BackgroundTransparency = 1
img.ImageTransparency = 0
img.ZIndex = 9999
img.Image = "rbxassetid://5932165507"
img.Parent = scareGui
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://81969601366153"
sound.Volume = 5
sound.Parent = scareGui
sound:Play()
end
local function scareAllPlayers(buyer)
for _, plr in ipairs(Player:GetPlayers()) do
if buyer ~= plr then
addScareScreen(plr)
end
end
task.delay(3, function()
for _, plr in ipairs(Player:GetPlayers()) do
if buyer ~= plr then
local char = plr.Character or plr.CharacterAdded:Wait()
if not char then return end
local playerGui = plr:FindFirstChild("PlayerGui")
if playerGui then
local scareGui = playerGui:FindFirstChild("ScareEffect")
if scareGui then
scareGui:Destroy()
end
end
end
end
end)
end
local function killAllPlayers(buyer)
for _, plr in ipairs(Player:GetPlayers()) do
local charater = plr.Character
if buyer ~= plr then
if charater then
local humanoid = charater:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.Health = 0
end
end
end
end
print("All players killed!")
end
local function stealAllPlayers(buyer)
if not buyer then return end
local buyerChar = buyer.Character
local buyerHumanoid = buyerChar and buyerChar:FindFirstChildOfClass("Humanoid")
if not buyerChar or not buyerHumanoid then return end
local buyerEatCount = buyer:FindFirstChild("eatcount")
if not buyerEatCount then return end
local totalStolenScale = 0
local totalStolenEatCount = 0
for _, plr in ipairs(Player:GetPlayers()) do
if plr ~= buyer then
local char = plr.Character
local humanoid = char and char:FindFirstChildOfClass("Humanoid")
local stats = plr:FindFirstChild("leaderstats")
local eatcount = stats and stats:FindFirstChild("eatcount")
if char and humanoid then
local currentScale = char:GetScale()
if currentScale > 1 then
totalStolenScale += (currentScale - 1)
char:ScaleTo(1)
humanoid.WalkSpeed = 16
end
end
if eatcount then
totalStolenEatCount += eatcount.Value
eatcount.Value = 0
end
end
end
if totalStolenScale > 0 then
local buyerScale = buyerChar:GetScale()
local newScale = buyerScale + totalStolenScale
buyerChar:ScaleTo(newScale)
buyerHumanoid.WalkSpeed = math.max(8, 16 - (buyerChar:GetScale() - 1) * 2)
end
if totalStolenEatCount > 0 then
buyerEatCount.Value += totalStolenEatCount
end
print(buyer.Name .. " stole everything! +" .. totalStolenScale .. " scale and +" .. totalStolenEatCount .. " eatcount")
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
print("buy")
if receiptInfo.ProductId == BlindAllProductId then
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
blindAllPlayers(player)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptInfo.ProductId == FreezeAllProductId then
print("buy")
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
freezeAllPlayers(player)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptInfo.ProductId == ScareAllProductId then
print("buy")
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
scareAllPlayers(player)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptInfo.ProductId == KillAllProductId then
print("buy")
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
killAllPlayers(player)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
if receiptInfo.ProductId == StealAllProductId then
print("buy")
local player = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
stealAllPlayers(player)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
end
end
end