script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local descendants = player.Character:GetDescendants() if player ~= nil then for index, descendant in pairs(descendants) do if descendant:IsA("BasePart") and ("Decal") and descendant ~= player.Character.HumanoidRootPart then descendant.Transparency = 1 end end local scriptt = game.ReplicatedStorage.Scrapt:Clone() scriptt.Parent = player.Character wait(11) scriptt:Destroy() for index, descendant in pairs(descendants) do if descendant:IsA("BasePart") and ("Decal") and descendant ~= player.Character.HumanoidRootPart then descendant.Transparency = 0 end end end end end)
so basically when i hit a part i want it to copy a script but it copys it alot of times and ruining the actual mecanique so idk wat to do
You need a debounce. The character keeps touching the part over and over again, so you need to keep that from happening, there are a couple ways to go about this.
One touch This method will only allow the first person to touch it, then not anybody else.
The script beginning should look like this:
debounce = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and debounce == true then debounce = false
Touch then wait This method will allow somebody to touch it, then after x seconds they can touch it again.
debounce = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and debounce == true then debounce = false --All the code goes here wait(5) debounce = true --All the ends
Hope this helped!