Ok so I tried getting this part I click to clone a tool from server storage, it works but I don’t know how to make it so you can only get one tool from it and stop it from making multiple tools in your backpack
Its a script inside the part in workspace
local Scroll = game:GetService("ServerStorage").Letter
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local Letter = Scroll:Clone()
Letter.Parent = player.Backpack
end)
Simple fix, just add an if statement to check if the player’s backpack has a name called: Letter
local Scroll = game:GetService("ServerStorage").Letter
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if player.Backpack:FindFirstChild("Letter") == nil and player.Character:FindFirstChild("Letter") == nil then
local Letter = Tool:Clone()
Letter.Parent = player.Backpack
end
end)
Can You Help Me with this one, i wanna do the same but at this one
local price = 6500
local db = true
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if player.leaderstats.Money.Value >= price then with your currency
player.leaderstats.Money.Value = player.leaderstats.Money.Value - price
db = false
game.ServerStorage["LMG"]:clone().Parent = player.Backpack
wait(10)
db = true
end
end)
local Price = 6500
local DB = true
local Part = script.Parent
local ToolToDetect = "LMG" --This would be the Tool Name
Part.ClickDetector.MouseClick:Connect(function(Plr)
local ToolCheck = game.ServerStorage:FindFirstChild(ToolToDetect)
if ToolCheck == nil then
warn("This tool is not currently in Server Storage!")
return
end
local Backpack = Plr:WaitForChild("Backpack")
local Char = Plr.Character
local leaderstats = Plr:WaitForChild("leaderstats")
local Money = leaderstats:WaitForChild("Money")
if Backpack:FindFirstChild(ToolToDetect) or Char:FindFirstChild(ToolToDetect) then
return
end
if Money.Value >= Price then
DB = false
Money.Value -= Price
local ToolClone = ToolCheck:Clone()
ToolClone.Parent = Backpack
task.wait(10)
DB = false
end
end)