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

TouchEnded not firing? help needed

Asked by 6 years ago
Edited 6 years ago

i was making a script that will open a door if a door touches it but TouchEnded will not close the door.

script.Parent.Touched:Connect(function(hit)
    if hit.name == "dttector" then
        script.Parent.Parent.a.Transparency = 1
        script.Parent.Parent.b.Transparency = 1
        script.Parent.Parent.c.Transparency = 1
        script.Parent.Parent.d.Transparency = 1
        script.Parent.Parent.e.Transparency = 1
    end
end)
script.Parent.TouchEnded(function(hit)
    if hit.name == "dttector" then
        script.Parent.Parent.a.Transparency = 0.8
        script.Parent.Parent.b.Transparency = 0
        script.Parent.Parent.c.Transparency = 0
        script.Parent.Parent.d.Transparency = 0
        script.Parent.Parent.e.Transparency = 0
    end
end)

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

This error is very simple and I actually did the same thing even though I've been scripting for 2 years. You simply forgot to say :Connect after TouchEnded

Ad

Answer this question