#Troll Button Not Working

1 messages · Page 1 of 1 (latest)

rich ledge
carmine bobcat
rich ledge
#

When a player presses this button and buys the developer product, an image is supossed to appear on the screen like a jumpscare + a sound, im gonna show the scripts and everything i did below, i got my script off chat gpt

.

#

Script inside ServerScriptService :

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

local event = ReplicatedStorage:WaitForChild("TrollEvent")

local PRODUCT_ID = 3562278603

MarketplaceService.ProcessReceipt = function(receiptInfo)
local buyer = Players:GetPlayerByUserId(receiptInfo.PlayerId)

if not buyer then
    return Enum.ProductPurchaseDecision.NotProcessedYet
end

if receiptInfo.ProductId == PRODUCT_ID then
    print(buyer.Name .. " bought Troll All!")

    for _, player in pairs(Players:GetPlayers()) do
        if player ~= buyer then
            event:FireClient(player)
        end
    end
end

return Enum.ProductPurchaseDecision.PurchaseGranted

end

#

LocalScript Inside Screen GUI :

local event = game.ReplicatedStorage:WaitForChild("TrollEvent")

local image = script.Parent:WaitForChild("ImageLabel")
local sound = image:WaitForChild("Sound")

event.OnClientEvent:Connect(function()
print("Troll triggered!") -- debug

image.Visible = true
sound:Play()

task.wait(3)
image.Visible = false

end)

#

LocalScript Inside The TextButton :

local button = script.Parent
local player = game.Players.LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")

local PRODUCT_ID = 3562278603

button.MouseButton1Click:Connect(function()
MarketplaceService:PromptProductPurchase(player, PRODUCT_ID)
end)

#

Images to help you understand where everything is :

formal current
#

so the issue is more like its checking if ProductId is = to nil not the product id you set

#

hope it works! happytu

rich ledge
#

it was receiptInfo.ProductId == PRODUCT_ID in the script already sadly.....

formal current
#

weird

rich ledge
#

hmm yea

formal current
#

let me try real quick in my studio and ill send you the fix

rich ledge
#

tyy

formal current
#

no problem :D

#

how is the script that is inside screen gui called?

unreal hedgeBOT
#

studio** You are now Level 1! **studio

formal current
#

@rich ledge

rich ledge
#

Troll

#

its a localscript

#

if thats the one u talking abt

formal current
#

yeah i see

#

does it print on the client side?

rich ledge
#

no idea 😭

#

like idk

formal current
#

can u check that for me?

rich ledge
#

how?

formal current
#

F9

#

in game

rich ledge
#

which one, test?

formal current
#

ye

rich ledge
formal current
#

does it happen after u buy the pass?

rich ledge
#

no

formal current
#

oh wait, do you want the jumpscare for everyone?

rich ledge
#

yea EXCEPT the one who buys it

formal current
#

even the player that bought it

rich ledge
#

no

formal current
#

ah

#

well im trying it right now and it works

rich ledge
#

hmmm

formal current
#
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local event = ReplicatedStorage:WaitForChild("TrollEvent")

local PRODUCT_ID = 3562278603

MarketplaceService.ProcessReceipt = function(receiptInfo)
    local buyer = Players:GetPlayerByUserId(receiptInfo.PlayerId)

    if not buyer then
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end

    if receiptInfo.ProductId == PRODUCT_ID then
        print(buyer.Name .. " bought Troll All!")

        for _, player in pairs(Players:GetPlayers()) do
            if player.UserId ~= buyer.UserId then
                event:FireClient(player)
            else
                print("buyer")
            end
        end
    end

    return Enum.ProductPurchaseDecision.PurchaseGranted
end```
#

try this

#

buy the pass in studio

#

and tell me what the output says

rich ledge
#

inside servicescriptserveice?

formal current
#

yep

rich ledge
#

still.....

formal current
#

what does trhe output say?

rich ledge
#

is ur image's visible = true or false?

rich ledge
formal current
#

yep

#

i gotta see the client and server tab

rich ledge
formal current
#

press the server tab

rich ledge
formal current
#

did u buy it?

rich ledge
#

YEA

#

caps

#

ill rebuy

formal current
#

hm

rich ledge
#

yup same thing

formal current
#

thats weird that it doesnt even say buyer

rich ledge
#

want me to give u perms to edit my game???

formal current
#

no i cant i gotta go sleep already, might be studio access

unreal hedgeBOT
#

studio** You are now Level 2! **studio

formal current
#

try replacing waitforchild with findfirstchild

rich ledge
#

which*

formal current
#

2nd one

rich ledge
#

i tested ur place

#

it works but not exactly how i want it to work, i want my image to pop up and then dissapear

formal current
#

Try putting the script that shows it in starterplayerscripts

rich ledge
#

u have a script under image label which i wasnt aware about, thats why urs worked