Tool.Handle.Touched event not firing at all

  1. What do you want to achieve? Keep it simple and clear!
    I want it so that when you touch one of the items cooked and thrown by the frying pan that has an effect, it gives that effect to whoever touches the item and destroys the tool

  2. What is the issue? Include screenshots / videos if possible!
    The script for detecting when an effect item is touched is not working at all.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have already tryed printing when the handle is touched, it did not fire. I have already checked if the “CanTouch” property is active, it is. I have already checked if the script is getting cloned to the effect items, it is.

Here is the poisenous effect script cloned into poisenous food items:

script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		plr.Character.Humanoid.Health -= 40
		script.Parent.Parent:Destroy()
	end
end)

Here is the server script for the frying pan:

game.ReplicatedStorage.TerminatedCook.OnServerEvent:Connect(function(plr, ItemName, ItemType)
	
	local Hold = plr.Character.Humanoid:LoadAnimation(script.Parent.Hold)
	local Cook = plr.Character.Humanoid:LoadAnimation(script.Parent.Cook)
	Hold.Looped = true


	for i, v in pairs(game.ReplicatedStorage["Terminated'sFryingPanFood"]:GetChildren()) do

		if v.Name == ItemName then

			if ItemType == "Normal" then

				local clone = v:Clone()
				clone.Parent = game.Workspace
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			elseif ItemType == "Poisenous" then

				local clone = v:Clone()
				local TP = script.Parent.TypeParticle:Clone()
				local scrpt = game.ReplicatedStorage.TerminatedsFoodScripts.Poisenous:Clone()
				scrpt.Parent = clone.Handle
				TP.Color = ColorSequence.new(Color3.fromRGB(201, 92, 255))
				TP.Parent = clone.Handle
				TP.Enabled = true
				clone.Parent = game.Workspace
				clone.Handle.TouchInterest:Destroy()
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			elseif ItemType == "Stun" then

				local clone = v:Clone()
				local TP = script.Parent.TypeParticle:Clone()
				local scrpt = game.ReplicatedStorage.TerminatedsFoodScripts.Stun:Clone()
				scrpt.Parent = clone.Handle
				TP.Color = ColorSequence.new(Color3.fromRGB(103, 144, 255))
				TP.Parent = clone.Handle
				TP.Enabled = true
				clone.Parent = game.Workspace
				clone.Handle.TouchInterest:Destroy()
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			elseif ItemType == "Heal" then

				local clone = v:Clone()
				local TP = script.Parent.TypeParticle:Clone()
				local scrpt = game.ReplicatedStorage.TerminatedsFoodScripts.Heal:Clone()
				scrpt.Parent = clone.Handle
				TP.Color = ColorSequence.new(Color3.fromRGB(112, 255, 102))
				TP.Parent = clone.Handle
				TP.Enabled = true
				clone.Parent = game.Workspace
				clone.Handle.TouchInterest:Destroy()
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			elseif ItemType == "Slow" then

				local clone = v:Clone()
				local TP = script.Parent.TypeParticle:Clone()
				local scrpt = game.ReplicatedStorage.TerminatedsFoodScripts.Slow:Clone()
				scrpt.Parent = clone.Handle
				TP.Color = ColorSequence.new(Color3.fromRGB(157, 79, 79))
				TP.Parent = clone.Handle
				TP.Enabled = true
				clone.Parent = game.Workspace
				clone.Handle.TouchInterest:Destroy()
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			elseif ItemType == "Speed" then

				local clone = v:Clone()
				local TP = script.Parent.TypeParticle:Clone()
				local scrpt = game.ReplicatedStorage.TerminatedsFoodScripts.Speed:Clone()
				scrpt.Parent = clone.Handle
				TP.Color = ColorSequence.new(Color3.fromRGB(0, 255, 234))
				TP.Parent = clone.Handle
				TP.Enabled = true
				clone.Parent = game.Workspace
				clone.Handle.TouchInterest:Destroy()
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			elseif ItemType == "Kick" then

				local clone = v:Clone()
				local TP = script.Parent.TypeParticle:Clone()
				local scrpt = game.ReplicatedStorage.TerminatedsFoodScripts.Kick:Clone()
				scrpt.Parent = clone.Handle
				TP.Color = ColorSequence.new(Color3.fromRGB(255, 0, 4))
				TP.Parent = clone.Handle
				TP.Enabled = true
				clone.Parent = game.Workspace
				clone.Handle.TouchInterest:Destroy()
				script.Parent.Weld.Part1 = clone.Handle
				Cook:Play()
				script.Parent.Handle.CookSound:Play()
				wait(0.5)
				script.Parent.FoodThrowable:FireClient(plr)
				Hold:Play()

			end
		end
	end
end)

script.Parent.FoodThrow.OnServerEvent:Connect(function(plr)
	local foodHandle = script.Parent.Weld.Part1
	local Throw = plr.Character.Humanoid:LoadAnimation(script.Parent.Throw)
	plr.Character["Right Arm"].CanTouch = false
	plr.Character["Right Arm"].CanQuery = false
	for i,v in pairs(plr.Character.Humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
	end
	Throw:Play()
	script.Parent.Handle.ThrowSound:Play()
	script.Parent.Weld.Part1 = nil
	foodHandle:ApplyImpulse(plr.Character.HumanoidRootPart.CFrame.LookVector * 10)
	foodHandle:ApplyImpulse(Vector3.new(0,40,0))
	print(plr.Character.HumanoidRootPart.CFrame.LookVector * 10)
	wait(1)
	plr.Character["Right Arm"].CanTouch = true
	plr.Character["Right Arm"].CanQuery = true
end)

A good video explaining it:

2 Likes

I can confirm its not the touched script code, likely something with your other server script handling the cloning and things.

My guess is the problem is related to the order in which you do things

When you do scrpt.Parent = clone.Handle
a few lines later you do clone.Handle.TouchInterest:Destroy(), removing the touch interest that got created when you cloned the script into the cheezburger, try removing that line and let me know what happens.

https://gyazo.com/19d406b52c5f055728e98dff9525873b

I’ll try that when i get home, thanks!

That totally worked, I guess it’s something in the background of roblox :sweat_smile: Thanks so much!

Your game looks cool, keep up the great work!
Glad I could help :+1:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.