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

My Touched function won't work, why?

script.Parent.Touched:connect(Touched)
function onTouched(hit)
	script.Parent.Parent.Door.Transparency= 1 -- an invisible door
	script.Parent.Parent.Door.CanCollide= false -- a walkthroughable door
	wait(3)
	script.Parent.Parent.Door.Transparency= 0.3  -- a partially visible door 
	script.Parent.Parent.Door.CanCollide= true -- a door you can't walk through anymore
end
script.Parent.Touched:connect(onTouched)

I have roblox 2014, but the tutorial I watched was 2013, can you please tell me why It won't work?

2 answers

Remove the first line. That first connection line isn't necessary (Unless if you're calling another function by the name of "Touched").

2 comments

0

Oh/

0

Plus, that argument "hit" isn't necessary also, since you're not using the argument at all (but you can leave it there if you want to).

I believe its on line 2 that you forgot the .Parent it should be ( I may be wrong, but give it a shot )

function onTouched(hit.Parent)

2 comments

0

I dont see anything wrong with the other parts of the script though.

1

This is wrong; it won't compile, and wouldn't make sense (parameters are what goes in, what would it mean to pass in hit.Parent if hit isn't defined?

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