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

Resize cookie on click?

Asked by 9 years ago

I can't figure out how to make the script make the cookie increase size then wait and decrease back to normal size whenever it's clicked. Please help!

1function Click() -- When the cookie is clicked
2    Player.Cookies.Value = Player.Cookies.Value + 1
3    script.Parent.Size = Vector3.new {0, 300},{0, 300}
4    wait(0.15)
5    script.Parent.Size = Vector3.new {0, 250},{0, 250}
6 
7end
8script.Parent.MouseButton1Click:connect(Click)

1 answer

Log in to vote
2
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
9 years ago

GuiObject's size and position properties do not hold Vector3 datatypes. They require UDim2 datatypes.

1function Click() -- When the cookie is clicked
2    Player.Cookies.Value = Player.Cookies.Value + 1
3    script.Parent.Size = UDim2.new(0, 300, 0, 300)
4    wait(0.15)
5    script.Parent.Size = UDim2.new(0, 250, 0, 250)
6end
7 
8script.Parent.MouseButton1Click:connect(Click)
Ad

Answer this question