How do you make this click effect?

I’m trying to achieve this click effect for my game.

How would you create this?

5 Likes
  • Get the player’s mouse on screen
  • Generate an animated sprite sheet (there are free resources on how to do it online)
  • Upload the sprite sheet.
  • Get the sprite offsets, and assign indexes to them
  • Per game tick, advance the index, this should animate the sprite.

This is code sample is from the official documentations, you can vastly improve this.

    -- Place this in an ImageLabel/ImageButton with size 256x256
    local imageLabel = script.Parent
     
    -- The following image is 1024x1024 with 12 frames (256x256)
    -- The frames play an animation of a man throwing a punch
    imageLabel.Image = "rbxassetid://848623155"
    imageLabel.ImageRectSize = Vector2.new(256, 256)
     
    -- The order of the frames to be displayed (left-to-right, then top-to-bottom)
    local frames = {
    	Vector2.new(0, 0); Vector2.new(1, 0); Vector2.new(2, 0); Vector2.new(3, 0);
    	Vector2.new(0, 1); Vector2.new(1, 1); Vector2.new(2, 1); Vector2.new(3, 1);
    	Vector2.new(0, 2); Vector2.new(1, 2); Vector2.new(2, 2); Vector2.new(3, 2);
    }
     
    -- Animate the frames one at a time in a loop
    while true do
    	for i = 1, #frames do
    		imageLabel.ImageRectOffset = frames[i] * imageLabel.ImageRectSize
    		wait(.1)
    	end
    end

Additionally, you can use a 2D particle engine to create it. You can use this one.

8 Likes