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

Event is not going through the first If statement even if I have more than cost in leaderboard?

Asked by 2 years ago

I have a button that gives a name tag if you click it, if you have less than the cost it prints "Insufficient funds" but if you have more than the cost it still prints "Insufficient funds" what is wrong in my script?

Not really any error appearing in the output.

Server script:

local nametagPurchases = game.ReplicatedStorage.NametagPurchases
local firstPage = nametagPurchases.FirstPage
local eventTags = firstPage.TagEvents

local customClone = nametagPurchases.CustomNameTag:Clone()

local remote = eventTags.Tag1

remote.OnServerEvent:Connect(function(player, color, strokecolor, tagname)
                                        -- 2 is the cost
    if player.leaderstats.Points.Value > 2 then 
                            -- I have 6 points currently
        firstPage.Tag1.Value = true

        print("You succesffuly bought the nametag!")

        customClone.NameText.Text = tagname
        customClone.NameText.TextColor3 = color
        customClone.NameText.TextStrokeColor3 = strokecolor

        customClone.Parent = player.Character.Head

    elseif player.leaderstats.Points.Value < 2 then

        firstPage.Tag1.Value = false

        print("Insufficient funds")

    end
end)

Localscript: (if needed)

for _,button in pairs(nametagHolders:GetDescendants()) do

    if button.Name == "Tag1" then

        button.Purchase.TextButton.MouseButton1Click:Connect(function()
            if firstPage.Tag1.Value == true then



            elseif firstPage.Tag1.Value == false then

                local customClone = customName:Clone()

                tagEvents1.Tag1:FireServer(Color3.fromRGB(217, 217, 217), Color3.fromRGB(0, 0, 0), "Progresser")

            end
        end)
0
Out of curiosity, how did you get the points? Is the points given with a server script or did you have to manually change it? XviperIink 428 — 2y

Answer this question