This is what I've tried..
1 | script.Parent.OpenButton.ClickDetector:OnClick() |
2 | script.Parent.Door.Size = 20 , 15 , 0.6 |
3 | wait( 1 ) |
4 | script.Parent.Door.Size = 20 , 14 , 0.6 |
5 | wait( 1 ) |
6 | script.Parent.Door.Size = 20 , 13 , 0.6 |
etc. Any ideas?
You have no connection lines, and Size is a Vector3 value meaning when you set it equal to something, it has to be a Vector3 value:
1 | script.Parent.OpenButton.ClickDetector.MouseClick:connect( function () -- Simpler way to use functions and connection lines |
2 | script.Parent.Door.Size = Vector 3. new( 20 , 15 , 0.6 ) --Assigning a new Vector3 value to size |
3 | wait( 1 ) --Waiting one second |
4 | script.Parent.Door.Size = Vector 3. new( 20 , 14 , 0.6 ) --Again |
5 | wait( 1 ) --Again |
6 | script.Parent.Door.Size = Vector 3. new( 20 , 13 , 0.6 ) --Yet again |
7 | end ) -- Parenthesis closes the connection line and end ends the function |
theres not much wrong with your code except your connection line try this
1 | function openButton() |
2 | script.Parent.Parent.Size = 20 , 15 , 0.6 -- i change door to parent |
3 | wait( 1 ) |
4 | script.Parent.Parent.Size = 20 , 14 , 0.6 --im assuming script is child of click detector which is child of door |
5 | wait( 1 ) |
6 | script.Parent.Parent.Size = 20 , 13 , 0.6 |
7 | end |
8 | script.Parent.MouseClick:connect(openButton) |
this should work
put this script as child of ClickDetector
1 | script.Parent.MouseClick:connect( function (click) if click then |
2 | script.Parent.Parent.Size = Vector 3. new( 20 , 15 , 0.6 ) |
3 | wait( 1 ) |
4 | script.Parent.Parent.Size = Vector 3. new( 20 , 14 , 0.6 ) |
5 | wait( 1 ) |
6 | script.Parent.Parent.Size = Vector 3. new( 20 , 13 , 0.6 ) |
7 | end end ) |