Part keeps duplicating itself and i cant delete or modify it

Hi, I hope i posted this in the right section since i dont know if its the script or something else.
Since im learning i took a model out of the roblox studio toolbox to learn.
So i have this part (with a script in it) in my project wich keeps duplicating himself in my workspace.
When i test the game, the part works as it should but it spawns duplicates on itself?

When i try to delete it, its coming back within a second. If i open the script window it closes itself. It seems i cant modify or delete this in any way. Is there something wrong with the script or is it a virus or maybe something else? Anybody has a thought on this one?

I have tried some virus remove plugins without results.

Since im a new user i cant upload a image. location of this part is workspace>part>script

 local replicatedStorage = game:GetService("ReplicatedStorage")
    script.Parent.Touched:Connect(function(hit)
    	if hit then
    	if hit.Parent:FindFirstChild("Humanoid") then
    		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    		if player then
    		replicatedStorage:WaitForChild("TriggerCamA"):FireClient(player)
    		end
    		end
    	end
    end)
3 Likes

You have to have a debounce on that script, or else it will fire a huge amount of times

3 Likes

thank you for your answer. So i looked it up and read about the debounce on the wiki. is it ment to be implented like below?

debounce=true
script.Parent.Touched:Connect(function(hit)
    if debounce == true then
        debounce = false -- prevents script to run event again.
        local replicatedStorage = game:GetService("ReplicatedStorage")
script.Parent.Touched:Connect(function(hit)
	if hit then
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
		replicatedStorage:WaitForChild("TriggerCamA"):FireClient(player)
		end
		end
	end
end)
        debounce = true -- allows script to run event again.
    end
end)

and if it is, how can i put the new script in? since its restoring itself to how it is right now. cant edit or delete the script at this point?

you have to put a wait(1) before the debouce becomes true again, and after you’ve done, that, it should be fixed

@partytonic, you dont really need the second touched event, you can delete that, there, you are done

1 Like
debounce=true
script.Parent.Touched:Connect(function(hit)
    if debounce == true then
        debounce = false -- prevents script to run event again.
        local replicatedStorage = game:GetService("ReplicatedStorage")
script.Parent.Touched:Connect(function(hit)
	if hit then
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
		replicatedStorage:WaitForChild("TriggerCamA"):FireClient(player)
		end
		end
	end
end)
        wait (1)
		debounce = true -- allows script to run event again.
    end
end)

is this correct?

I see you are sending a request, what happens when the event fires? There’s any script which do a function when the event is getting fired?

Than it will open up the toolshop gui.

But the strange part is that i cant modify the part with the script in any way. it keeps duplicating and if i delete/modify the part (or script) it restores itself?

so lets say i dont want to use it anymore…how do i delete it?

That’s because it’s duplicating, or something is not allowing to the client edit parts.

cant i stop scripts from running or something like that? its weird that i cant delete it or modify it. so i have to make a new project?

You could try to find some script and remove/delete/disable them and see if it stops, and delete/modify the script which was causing that. If you can you can send us the place, and remove some scripts to prevent people stealing them.

i did a script in workspace with:

workspace.Part.Script.Disabled=true or

workspace.Part.Script:Destroy()

it disabled the script but i cant do anything with the part… i think workspace.Part.Script:Destroy() is not correct aswell… if i delete this script the other script is back again… so it was only disabled

1 Like

Maybe it’s a virus very very very hidden in a script, a backdoor or a plugin. Also, could you try to send us a screenshot/video? That might be useful!

Its solved now! @Conejin_Alt was able to delete the part from my file. thanks alot for your time and effort to help me sort this out!

1 Like