Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I edit PlayerGui from a server script?

Asked by 4 years ago

I can't edit PlayerGui from server script.

--hi
game.ReplicatedStorage:WaitForChild("RespawnProduct").OnServerEvent:Connect(function(plr, deathGui)
local marketplaceService = game:GetService("MarketplaceService")
local id = 946005840
local humanoid = plr.Character.Humanoid
print(deathGui.Parent.Name)

marketplaceService.ProcessReceipt = function(receiptInfo) 
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            if(tonumber(receiptInfo.ProductId) == id)then
                         print("hey")
                         wait(1)
                    deathGui.Frame.Visible = false
                   deathGui.Frame.Active = false
            end
        end 
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

end)

There are no errors in the output. It also prints "hey" .

Answer this question