-- Inside LocalScript --
shop.KnifeFrame.MainFrame.Buttons.Buy1.MouseButton1Click:connect(function(onClick)
confirmframe.Visible = true
confirmtext.Text = "Are you sure you want to buy 'Foil Knife' ?"
confirmyes.MouseButton1Click:connect(function(buy)
local running = true
if player.Credits.Value > 99 and running == true then
player.Credits.Value = player.Credits.Value - 100
purchasedprompt.Visible = true
purchasedtext.Text = "You have brought 'Foil Knife' for 100 Credits"
confirmframe.Visible = false
running = false
elseif player.Credits.Value < 100 and running == true then
purchasedprompt.Visible = true
purchasedtext.Text = "You don't have enough credits to buy"
confirmframe.Visible = false
running = false
end
end)
end)
For some reason when the player has 100 credits, it says you dont have enough credits, but it takes 100 away, but if you have 300 credits then it takes 300 away and says you have brought the item, I don't know why there is this glitch. Please anyone help.
- NinjoOnline

1 comment
Make the credits object a variable