Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to only allow a model to clone when you have enough currency on your leaderstat?

I only have the cloning part and purchasing system done, so it spawns in when you press the text button and it reduces your money. I'm not sure what to add to make it only clone when there is enough currency in the leaderstat. For example, the price is 200 and I only want it to clone only when you have 200 in the leaderstat. The cloning is also set up with a text button so when you press it, the clone happens. So, all i need is the script add ons to make it only happen when you purchase it with enough money.

--My Script:

**local player = game.Players local button = script.Parent

button.MouseButton1Click:Connect(function() ClonedTalent = game.ServerStorage.Talents.Ben:Clone() ClonedTalent.Parent = game.Workspace ClonedTalent.Name = "Talent" end)**

1 answer

✓ Accepted answer
local button = script.Parent
local gui=button.Parent
local player=gui.Parent.Parent 

button.MouseButton1Click:Connect(function()
if player.leaderstats.Points.Value>=200 then
player.leaderstats.Points.Value-=200

 ClonedTalent = game.ServerStorage.Talents.Ben:Clone() 
ClonedTalent.Parent = game.Workspace 
ClonedTalent.Name = "Talent"


end;end)

This discussion is preserved as it was. New answers, comments, and votes are closed.