So i was making a teleporter for my tycoon game, and i made a teleporter but the output shows the error "attempt to index nil with 'Touched' " even tho im doing it in a part, ill put the code

local Sender = script.Parent
local Reciever = Sender.Parent:WaitForChild("Reciver")

Sender.Touched:Connect(function(hit)
	if hit.Name == "Ore" then
		hit.Position = Reciever.Position
	end
end)

i dont find an error on that code, the script is parented to a part so i dont know why the error happens,.

3 comments

0

If the ore is multiple parts maybe try only listing one of the parts of the ore instead of the whole thing, but thats only if it has multiple parts

0

the ore is just one part

0

is sender a model?