game.Players.PlayerAdded:Connect(function(plr)
game.Workspace.too.Touched:Connect(function(hit)
local fld = Instance.new("Folder")
fld.Parent = plr.StarterGear
local st = plr:FindFirstChild("StringValue")
if not st then
local newSt = Instance.new("StringValue")
newSt.Name = newSt.ClassName
newSt.Parent = plr.StarterGear.Folder
end
end)
end)
COMMUNITY QUESTION
how do i stop a touched statement from running multiple times?
1 answer
Make a debounce.
local Debounce = true
game.Players.PlayerAdded:Connect(function(plr)
game.Workspace.too.Touched:Connect(function(hit)
if Debounce then
Debounce = not Debounce
local fld = Instance.new("Folder")
fld.Parent = plr.StarterGear
local st = plr:FindFirstChild("StringValue")
if not st then
local newSt = Instance.new("StringValue")
newSt.Name = newSt.ClassName
newSt.Parent = plr.StarterGear.Folder
end
end
end)
end)
1 comment
0
Yep! This works, and then if you want it to run after a couple seconds add wait(2) Debounce = true at the end.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
local wasTouched=false; right after the Connect function put if wasTouched==false then and put wasTouched= true and put "end" right before the end of the .Touched function