Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

what wrong with this script?

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

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) 

3 comments

0

Tested,failed

0

Is your hierarchy correct? I cannot tell if it is not sorry

0

just note

This discussion is preserved as it was. New answers, comments, and votes are closed.