#need help with buying dev products

1 messages · Page 1 of 1 (latest)

whole meteor
#

idk what am doing wrong in my script but when i buy smth it doest apply to me

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

local adminEvent = ReplicatedStorage:WaitForChild("AdminAction")

adminEvent.OnServerEvent:Connect(function(player, action)
if action == "BanAll" then
for _, p in pairs(Players:GetPlayers()) do
if p ~= player then
p:Kick("You were banned by admin!")
end
end
elseif action == "FreezeAll" then
for _, p in pairs(Players:GetPlayers()) do
if p ~= player and p.Character and p.Character:FindFirstChildOfClass("Humanoid") then
local hum = p.Character:FindFirstChildOfClass("Humanoid")
hum.WalkSpeed = 0
hum.JumpPower = 0
task.delay(20, function()
if hum then
hum.WalkSpeed = 16
hum.JumpPower = 50
end
end)
end
end
elseif action == "PushAll" then
local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
local look = root and root.CFrame.LookVector or Vector3.new(0, 0, 1)
for _, p in pairs(Players:GetPlayers()) do
if p ~= player and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
p.Character.HumanoidRootPart.Velocity = look * 100
end
end

#

elseif action == "SpeedBoost" then
local tag = player:FindFirstChild("HasSpeedBoost")
if not tag then
tag = Instance.new("BoolValue")
tag.Name = "HasSpeedBoost"
tag.Value = true
tag.Parent = player
else
tag.Value = true
end

    local hum = player.Character and player.Character:FindFirstChildOfClass("Humanoid")
    if hum then
        hum.WalkSpeed = 32
    end
end

end)

Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
local tag = player:FindFirstChild("HasSpeedBoost")
if tag and tag.Value == true then
hum.WalkSpeed = 32
end
end)
end)

#

thats whole script but in 2 parts bc its too long to fit in one text

supple forum
#

none of them work?

whole meteor
#

i only tried 2x speed but that didnt applied and idk how can i try the other 3 when am alone

supple forum
#

have you tried debugging with some prints

#

to see if the code even gets it there

whole meteor
wooden yewBOT
#

studio** You are now Level 4! **studio

supple forum
#

try it

whole meteor
quiet dawn
#

And recode it

#

Do not use remote events to confirm purchase

#

Use proceed reciept

#

also even if thats not for dev product thats still worst possible code, any exploiter can freely kick everyone

whole meteor
whole meteor
#

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

-- IDs
local products = {
[3327968854] = "BanAll",
[3327967937] = "FreezeAll",
[3327966562] = "PushAll",
[3327965520] = "SpeedBoost"
}

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

local productAction = products[receiptInfo.ProductId]
if not productAction then
    return Enum.ProductPurchaseDecision.PurchaseGranted
end

if productAction == "BanAll" then
    for _, p in pairs(Players:GetPlayers()) do
        if p ~= player then
            p:Kick("You were banned by admin!")
        end
    end

elseif productAction == "FreezeAll" then
    for _, p in pairs(Players:GetPlayers()) do
        if p ~= player and p.Character and p.Character:FindFirstChild("Humanoid") then
            local hum = p.Character.Humanoid
            hum.WalkSpeed = 0
            hum.JumpPower = 0
            task.delay(20, function()
                if hum then
                    hum.WalkSpeed = 16
                    hum.JumpPower = 50
                end
            end)
        end
    end
#

elseif productAction == "PushAll" then
local root = player.Character and player.Character:FindFirstChild("HumanoidRootPart")
local look = root and root.CFrame.LookVector or Vector3.new(0, 0, 1)
for _, p in pairs(Players:GetPlayers()) do
if p ~= player and p.Character and p.Character:FindFirstChild("HumanoidRootPart") then
p.Character.HumanoidRootPart.Velocity = look * 100
end
end

elseif productAction == "SpeedBoost" then
    local hum = player.Character and player.Character:FindFirstChild("Humanoid")
    if hum then
        hum.WalkSpeed = 32
        -- Navždy — ak chceš reset, pridaj task.delay
    end
end

return Enum.ProductPurchaseDecision.PurchaseGranted

end

MarketplaceService.ProcessReceipt = processReceipt

#

@quiet dawn

quiet dawn
#

looks good (ai) but i see few potiential issues

#

first of all

#

if not productaction then returns purchasegranted?

#

huh

#

thats failed no?

whole meteor
#

wym

quiet dawn
#

and id say return granted after each given
so when u got code for ban all, just return sucess after it does the logci

quiet dawn
#

that should be purchase failed

#

as no action was found

#

so nothing was given to player

whole meteor
quiet dawn
#

Good

whole meteor
quiet dawn
whole meteor
quiet dawn
#

Server code u done is only handling when u click buy

#

On the prompt

whole meteor
#

lemme send the script that works

whole meteor
# quiet dawn On the prompt

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

-- Product IDs
local productFunctions = {
[3327968854] = function(player) -- BAN ALL!
for _, p in pairs(Players:GetPlayers()) do
if p ~= player then
p:Kick("You were banned by admin!")
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end,

[3327967937] = function(player) -- FREEZE
    for _, p in pairs(Players:GetPlayers()) do
        if p ~= player and p.Character and p.Character:FindFirstChildOfClass("Humanoid") then
            local hum = p.Character:FindFirstChildOfClass("Humanoid")
            hum.WalkSpeed = 0
            hum.JumpPower = 0
            task.delay(20, function()
                if hum then
                    hum.WalkSpeed = 16
                    hum.JumpPower = 50
                end
            end)
        end
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted
end,