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

Trying to make doors open but nothing happens?

Asked by 4 years ago
-- Variables
local LeftDoor = workspace.Ticket_Scanner.Left_Door
local RightDoor = workspace.Ticket_Scanner.Right_Door
local LeftOpen = workspace.Ticket_Scanner.Left_Door_Open
local RightOpen = workspace.Ticket_Scanner.Right_Door_Open
local Scanner = workspace.Ticket_Scanner.Scanner.Scanner_Display
local Assest = 5976807639
local Ready = 5976807535




workspace.Ticket_Scanner.Scanning_Area.Touched:Connect(function(hit)
    if hit.Scanning_Area.Name == "TicketPlaceHolder" then
        LeftDoor.Transparency = 1
        RightDoor.Transparency = 1
        RightOpen.Transparency = 0.3
        LeftOpen.Transparency = 0.3
        Instance.new("Decal", Scanner)
        Scanner.Decal.Texture = Assest
        wait(2.5)
        Scanner.Decal.Texture = Ready
        LeftDoor.Transparency = 0.3
        RightDoor.Transparency = 0.3
        RightOpen.Transparency = 1
        LeftOpen.Transparency = 1
    end
end)    

^^ My code.

I am trying to make a Ticket Scanner, with opening doors (not with Tween or CFrame, just 2 parts) and it is not working. No errors whatsoever.

2 answers

Log in to vote
1
Answered by
Axmos 25
4 years ago

It's probably due to the fact you don't have any other if statements to justify/compliment the first one, for example:

if hit.Scanning_Area.Name == "TicketPlaceHolder" then
        LeftDoor.Transparency = 1
        RightDoor.Transparency = 1
        RightOpen.Transparency = 0.3
        LeftOpen.Transparency = 0.3
        Instance.new("Decal", Scanner)
        Scanner.Decal.Texture = Assest
        wait(2.5)
        Scanner.Decal.Texture = Ready
        LeftDoor.Transparency = 0.3
        RightDoor.Transparency = 0.3
        RightOpen.Transparency = 1
        LeftOpen.Transparency = 1
elseif
    hit.Scanning_Area.Name ~= "TicketPlaceHolder" then
    -- Do whatever you want.
end

Hope this helps!

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

From what I understand you're making a door where you make the closed position invisible and make the open one visible. You're forgetting to set CanCollide = false on the closed position doors since you don't move them away.

-- Variables
local LeftDoor = workspace.Ticket_Scanner.Left_Door
local RightDoor = workspace.Ticket_Scanner.Right_Door
local LeftOpen = workspace.Ticket_Scanner.Left_Door_Open
local RightOpen = workspace.Ticket_Scanner.Right_Door_Open
local Scanner = workspace.Ticket_Scanner.Scanner.Scanner_Display
local Assest = 5976807639
local Ready = 5976807535




workspace.Ticket_Scanner.Scanning_Area.Touched:Connect(function(hit)
    if hit.Scanning_Area.Name == "TicketPlaceHolder" then
        LeftDoor.Transparency = 1
        RightDoor.Transparency = 1
        RightOpen.Transparency = 0.3
        LeftOpen.Transparency = 0.3
        --Make the doors not solid.
        LeftDoor.CanCollide = false
        RightDoor.CanCollide = false
        Instance.new("Decal", Scanner)
        Scanner.Decal.Texture = Assest
        wait(2.5)
        Scanner.Decal.Texture = Ready
        LeftDoor.Transparency = 0.3
        RightDoor.Transparency = 0.3
        RightOpen.Transparency = 1
        LeftOpen.Transparency = 1
        --Make the doors solid again.
        LeftDoor.CanCollide = true
        RightDoor.CanCollide = true
    end
end)    

Hope this code works for what you're making.

Answer this question