So I am NOT trying to request you to write me a script I would just like someone to explain to me how to do it or point me to a source that gives you the answer if you would like to write a script that is fine. But I do not have a script.
COMMUNITY QUESTION
How to make it where you buy a tool takes away other tool? (MUST READ DESC)
1 answer
Even though this technically isn't a request site, and even though your question is a request, I'll still answer this for you.
Easiest Method: This would be done by simply adding a purchase gui into the startergui. When a player clicks that purchase button, add this script:
local cost = 20
script.Parent.MouseButton1Click:Connect(function(plr)
if plr.leaderstats.Cash.Value > cost - 1 then
local tool = game.ReplicatedStorage.NewTool:Clone()
tool.Parent = plr.Backpack
if plr.Backpack:FindFirstChild("OldTool") then
plr.Backpack.OldTool:Destroy()
end
end
end)
This script is made assuming that you have a leaderstats value for your currency. This is also saying that the tool your are purchasing is in the ReplicatedStorage. I hope this works and answers your question.
This discussion is preserved as it was. New answers, comments, and votes are closed.
