I have a button that gives a name tag for 5 points and if you have less than 5 points then it will print "Insufficient funds" but if you have more than the cost of points it will still print "Insufficient funds" what's wrong in my script?
There's not really any error 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, cost, color, strokecolor, tagname) print(player.Name) print(cost) if player.leaderstats.Points.Value >= cost then 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 < cost then firstPage.Tag1.Value = false print("Insufficient funds") end end)
Localscript:
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(5, Color3.fromRGB(217, 217, 217), Color3.fromRGB(0, 0, 0), "Progresser") end end)