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

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) 

The H1 is a part ,l place at: Workspace>Model>Model>H1(Part)

1 comment

0

l need a fix script

1 answer

✓ Accepted answer

On your connection line you have script.Parent.Parent.Touched. Is script.Parent.Parent the part 'H1'? The script.Parent.Parent in your code snippet declares which part triggers the touched event. If that was your problem, here is the fix.

local part = game.Workspace.Model.Model.H1 -- Put the location of the part 'H1' here

part.Touched:connect(function(hit)
	if script.Parent.Parent.DoorL.Value == false then
		script.Parent.Parent.DoorL.Value = true
		wait(60)
		script.Parent.Parent.DoorL.Value = false
	end
end)

1 comment

0

Thanks

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