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 8 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!

function Click() -- When the cookie is clicked
    Player.Cookies.Value = Player.Cookies.Value + 1
    script.Parent.Size = Vector3.new {0, 300},{0, 300}
    wait(0.15)
    script.Parent.Size = Vector3.new {0, 250},{0, 250}

end
script.Parent.MouseButton1Click:connect(Click)

1 answer

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

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

function Click() -- When the cookie is clicked
    Player.Cookies.Value = Player.Cookies.Value + 1
    script.Parent.Size = UDim2.new(0, 300, 0, 300)
    wait(0.15)
    script.Parent.Size = UDim2.new(0, 250, 0, 250)
end

script.Parent.MouseButton1Click:connect(Click)
Ad

Answer this question