So I am trying to make a part and if you click then it will add a folder with an int value in it but if i click it again then it will put another folder in it does anybody know how to stop this?
Here is my script:
local Tool2 = script.Parent
local Tool2Damage = Tool2.Folder.Tool2Damage
Tool2Damage.Value = 3
local MinePartsFolder = game.Workspace.MinePartsFolder -- The folder where all of the parts that you can mine are in
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Equipped:Connect(function()
mouse.Button1Down:Connect(function()
if mouse.Target and mouse.Hit then
if mouse.Target.Name == "MinePart" then
local HealthFolder = Instance.new("Folder", mouse.Target) -- Adding the folder into the part that you clicked
HealthFolder.Name = "HealthFolder"
local Health = Instance.new("IntValue", HealthFolder) -- Adding the int value into the folder
Health.Name = "Health"
Health.Value = 15
end
end
end)
end)

2 comments
can you make your code in a code block?
edited the question to include the codeblock and indented the code properly