Roblox Guide Help

Popup Module


This module aims to let you create temporary popups on the screen of your players.

Installation

In your wally.toml file, add this to your dependencies:

[dependencies] popup-module = "release/popup-module@0.0.5"

Import

You have two solutions to import this module, depending if you wish to import the Controller or the Service on your own, or if you let the module give you the right code.

local PopupModule = require(ReplicatedStorage.Packages["popup-module"])
local PopupController = Knit.GetController("PopupController") -- This module is client side, there is no Service here.

Configuration

Usage

Client Side

This method allows you to create a popup that will spaw on the screen of the player. It returns a popup table that is useful for the second method of this module.

Usage

PopupModule:SpawnPopup(image, text, type)

Explanation

  • image: The image for your popup.

  • text: The text displayed under the image of your popup.

  • type: Can be money or nil, and is used to determine the popup movements later.


local Popup = PopupModule:SpawnPopup("rbxassetid://0", "+10 Coins", "money")

    This method allows you to move a popup around the screen of the player. A previously created popup is needed for this function to work correctly. It returns a Tween to which you can connect.

    Usage

    PopupModule:TweenToPosAndSize({ Frame, Text, Position, Size })

    Explanation

    • Frame: The Frame of your popup. You can access it using Popup.Frame.

    • Text: The Text of your popup. You can access it using Popup.Text.

    • Position: The new position of your Frame after the animation.

    • Size: The new size of your Frame after the animation.


    local Move = PopupModule:TweenToPosAndSize({ Frame = Popup.Frame, Text = popup.Text, Position = UDim2.fromScale(0.3, -0.05), Size = UDim2.fromScale(0.10, 0.10) }) Move.Completed:Connect(function() popup.Frame:Destroy() end)
      Last modified: 22 November 2024