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

How would I make a brick change size starting when a ClickDetector is clicked? [Partly Answered]

Asked by 10 years ago

This is what I've tried..

script.Parent.OpenButton.ClickDetector:OnClick()
script.Parent.Door.Size = 20, 15, 0.6
wait(1)
script.Parent.Door.Size = 20, 14, 0.6
wait(1)
script.Parent.Door.Size = 20, 13, 0.6

etc. Any ideas?

3 answers

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
10 years ago

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:

script.Parent.OpenButton.ClickDetector.MouseClick:connect(function() -- Simpler way to use functions and connection lines
    script.Parent.Door.Size = Vector3.new(20,15,0.6) --Assigning a new Vector3 value to size
    wait(1) --Waiting one second
    script.Parent.Door.Size = Vector3.new(20,14,0.6) --Again
    wait(1) --Again
    script.Parent.Door.Size = Vector3.new(20,13,0.6) --Yet again
end) -- Parenthesis closes the connection line and end ends the function
Ad
Log in to vote
0
Answered by 10 years ago

theres not much wrong with your code except your connection line try this

function openButton()
    script.Parent.Parent.Size = 20, 15, 0.6 -- i change door to parent
    wait(1)
    script.Parent.Parent.Size = 20, 14, 0.6 --im assuming script is child of click detector which is child of door
    wait(1)
    script.Parent.Parent.Size = 20, 13, 0.6
end
script.Parent.MouseClick:connect(openButton)


this should work

0
It got an argument where we were setting the size, it expected a Vector3. I forgot how to work that, do you mind editing it real quick? SchonATL 15 — 10y
Log in to vote
-2
Answered by 10 years ago

put this script as child of ClickDetector

script.Parent.MouseClick:connect(function(click) if click then
script.Parent.Parent.Size = Vector3.new(20,15,0.6)
wait(1)
script.Parent.Parent.Size = Vector3.new(20,14,0.6)
wait(1)
script.Parent.Parent.Size = Vector3.new(20,13,0.6)
end end)
0
That didn't work, and just a reminder, there's a LUA button that lets you put code in it, for it to look like it does in studio. SchonATL 15 — 10y
0
Put the ClickDetector in the "door" then put a script in the ClickDetector and copy and paste the code above into the script. It should work. it worked for me. shadowsonichedgehogx -2 — 10y

Answer this question