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

How do I make this Door card script actually work and function correctly?

Asked by
Kitorari 266 Moderation Voter
8 years ago
script.Parent.Touched:connect(function(Part)
        if Part.Name == "Card" then
        if Part.Handle.CardNumber.Value == script.Parent.RoomNumber.Value then
            print("Holy you did it!")
            else print("well fudge.")
        end
        end
end)


There's no errors, and all values match. What am I doing wrong? Help would be great =u='

0
is it a local script? DevingDev 346 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago
script.Parent.Touched:connect(function(hit)
    if hit.Name == "Card" and hit.Handle.CardNumber.Value == script.Parent.RoomNumber.Value then
        script.Parent.CanCollide = false
    end
end)

This should do it; however if you would like to make it close after a few seconds then do this.


script.Parent.Touched:connect(function(hit) if hit.Name == "Card" and hit.Handle.CardNumber.Value == script.Parent.RoomNumber.Value then script.Parent.CanCollide = false wait(5) script.Parent.CanCollide = true end end)
Ad

Answer this question