Object.Touched not working

I am trying to clone a certain part a few times, and see if any of the clones had been touched.

When the cloned parts are touched, the event isn’t triggered.

I tried using Instance.new(), but I found it to be ineffective, because the certain part that I am cloning happens to be a mesh.

Is there any easy way to fix that?
If you need me to send something, please ask.
Thanks in advance

There isn’t any code we can fix.


Try putting prints to see how far the event is going forward, if something isn’t printing, you know that is not working.
AFAIK when cloning objects, scripts would be the same too, but it must be how you wrote your script.

Can you provide your code and setup? There’s nothing we can do here without understanding what you are doing properly.

It doesn’t even enter the event. I heard from a friend that when I use a script to clone parts, and use the variable I use to clone it in order to try and trigger the event, the Touched event won’t be triggered for some reason. I am trying to find an alternative for that.

The code is quite long, even if I send it, I don’t think it would really help you.

If this issue continues, contact devforum staff about the bug,

But if you fire a function many times somtimes it dosen’t work!

1.Try to fire it only once

Name the trigger part with any name
Try this script below!

      if hit.Name == "name" then
       --- function
   end
end)
  1. Try to use a local script to clone()

If its not a building system or if its ok to be invisible for other players!

  1. If it prints any error try to fix the error and check if it works

This is the script. it calls for another that calls it back. It is a client side ran vfx

local ReplicaedStorage = game:GetService('ReplicatedStorage')
local TweenService = game:GetService('TweenService')
local UIS = game:GetService('UserInputService')

local Remote = ReplicaedStorage.MovesRemotes:WaitForChild(script.Name)
local player = game.Players.LocalPlayer
game.Workspace:WaitForChild(player.Name)
local char = player.Character

local IceFolder = Remote.Meshes

local cooldown = 5
local debounce = false

local damage = 25

UIS.InputBegan:Connect(function(key,isTyping)
	if isTyping then
		return
	elseif key.KeyCode == Enum.KeyCode.Z and not debounce and char then
		debounce = true
		char.PrimaryPart.Anchored = true
		Remote:FireServer(player, damage)
		wait(cooldown)
		char.PrimaryPart.Anchored = false
		debounce = false
	end
end)

Remote.OnClientEvent:Connect(function(vfx_player, vfx_Damage)
	
	local PlrFolder = game.Workspace.Skills[vfx_player.Name]
	local Folder = Instance.new('Folder', PlrFolder)
	Folder.Name = script.Name
	
	local val = -4
	local sizez = 3
	local sizex = 10
	local sideval = 1/2
	
	local Shards = {}
	local function Ice()
		local extra = math.random(-11, 11) / 10
		local Shard = IceFolder:WaitForChild("IceSpike1"):Clone()
		Shard.Name = "IceShard " .. #Shards + 1
		table.insert(Shards, Shard)
		local side = math.random(-sideval, sideval)
		up = Shard.Size.Y/2
		local rotate = math.random(0, 180)
		
		local MRo = math.random(99,100)
		if MRo == 99 then
			local SRo = math.random(8, 10) / 10
			URo = MRo + SRo
		else
			local SRo = math.random(1, 3) / 10
			URo = MRo + SRo
		end
		
		Shard.Size = Vector3.new(sizez, sizex, sizez)
		Shard.CFrame = char.HumanoidRootPart.CFrame * CFrame.new(side, -up, val + extra)
		Shard.Parent = Folder
		Shard.CFrame = Shard.CFrame * CFrame.fromEulerAnglesXYZ(URo, rotate, 0.4)
		
		val -= 2
		sizez += 1
		sizex += 1
		sideval += 0.5
		game.Debris:AddItem(Shard,5)
		
		spawn(function()
			wait(.5)
			
			local tweenInfo = TweenInfo.new(
				.3,
				Enum.EasingStyle.Linear,
				Enum.EasingDirection.Out,
				0,
				false,
				0
			)
			
			local properties = {CFrame = Shard.CFrame * CFrame.new(0, up ^ 1.5,0)}
			
			local Tween = TweenService:Create(Shard, tweenInfo, properties)
			Tween:Play()
		end)
	end
	
	for i = 1, 50, 1 do
		Ice()
		wait()
	end
	local DamageDebounce = {}
	for _,v in pairs(Shards) do
		spawn(function()
			v.Touched:Connect(function(hit)
				local char = player.Character
				if hit:IsDescendantOf(char) and hit:FindFirstAncestorOfClass("Model") then
					if hit:FindFirstAncestorOfClass("Model").Name ~= vfx_player.Name then
						if not table.find(DamageDebounce, hit:FindFirstAncestorOfClass("Model")) then
							table.insert(DamageDebounce, hit:FindFirstAncestorOfClass("Model"))
							hit:FindFirstAncestorOfClass("Model"):FindFirstChild("Humanoid"):TakeDamage(vfx_Damage)
						end
					end
				end
			end)
		end)
	end
end)

I would recommend disconnecting the listeners in the shards when they have been touched or after a delay. This is so threads aren’t running when uneeded.