hi readers can you help me? i have a problem with this script. where when Player buy Trail and their money is not enough, then my Games will offer to buy money to Player. but the mistake when i have bought Trail messages to buy money suddenly appear when it should not appear because i have bought trail.
Video
so what’s wrong with this script???
local MPS = game:GetService("MarketplaceService")
local MarketplaceService = game:GetService("MarketplaceService")
local productID = 1923524272
local function displayInsufficientFundsMessage()
local message = script.Parent.A.Info.Frame.TrailName
message.Text = "Money Not Enough"
end
script.Parent.A.Info.Frame.Buy.MouseButton1Down:Connect(function()
local Trail = script.Parent.A.Info.Frame.TrailName.Text
if game.ReplicatedStorage.Trails:FindFirstChild(Trail) then
local Player = game.Players.LocalPlayer
local Currency = Player.leaderstats[game.ReplicatedStorage.Trails.Curency.Value]
local Price = game.ReplicatedStorage.Trails[Trail].Price
if Price:FindFirstChild("ID") and Player.Trails[Trail].Value == false then
MPS:PromptGamePassPurchase(Player,Price.ID.Value)
else
if Currency.Value < Price.Value then
MarketplaceService:PromptProductPurchase(Player, productID)
else
end
script.Parent.BuyEvent:FireServer(Trail)
end
end
end)