Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Attempt to index nil with 'Touched'?

Asked by 2 years ago

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,.

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 therealjimmybob 22 — 2y
0
the ore is just one part fsadsafdsfsf 15 — 2y
0
is sender a model? CosmicIsGod 139 — 2y

Answer this question