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

what wrong with this script?

Asked by 9 years ago
function onTouched(hit)  

     if hit.Name == "H1" then 

     if script.Parent.Parent.DoorL.Value == false then 

     script.Parent.Parent.DoorL.Value = true 

     wait(60)  

     script.Parent.Parent.DoorL.Value = false 

     end 

     end 

     script.Parent.Parent.Touched:connect(onTouched) 

1 answer

Log in to vote
2
Answered by
25564 200 Moderation Voter
9 years ago

You are missing an end. You need an end for the function and one for each of the if statements.

function onTouched(hit)  
    if hit.Name == "H1" then 
        if script.Parent.Parent.DoorL.Value == false then 
            script.Parent.Parent.DoorL.Value = true 
            wait(60)  
            script.Parent.Parent.DoorL.Value = false 
        end 
    end 
end

script.Parent.Parent.Touched:connect(onTouched) 

0
Tested,failed 7785543 2 — 9y
0
Is your hierarchy correct? I cannot tell if it is not sorry 25564 200 — 9y
0
just note 7785543 2 — 9y
Ad

Answer this question