Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why can this script not remove the touchinterest from a tool inside workspace?

workspace.Items.ChildAdded:Connect(function(Item)
	Item:FindFirstChild("TouchInterest"):Destroy()
end)



workspace.ChildAdded:Connect(function(Child)
	if Child:IsA("Tool") then
		wait()
		Child.Parent = workspace.Items
	end
end)

all it gives is

 22:53:41.851 - ServerScriptService.TouchRemover:2: attempt to index a nil value
22:53:41.852 - Stack Begin
22:53:41.853 - Script 'ServerScriptService.TouchRemover', Line 2
22:53:41.853 - Stack End

4 comments

0

Try WaitForChild instead of FindFirstChild on line 2

0

Pretty sure the touch interest gets removed when it's out of your hand, and why do you need to delete it?

0

Disconnecting a Touch Event also invalidates its TouchInterest object.

0

@incapaxx e to pick up system

1 answer

Like @Lazarix9 said, you should be using WaitForChild() when using ChildAdded especially in workspace. Look at this guide on the ChildAdded event.

1 comment

0

The item is already loaded when parented to the tools folder.

This discussion is preserved as it was. New answers, comments, and votes are closed.