Roblox Guide Help

VFX Module

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

[dependencies] vfx-module = "release/vfx-module@0.0.1"

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 VfxModule = require(ReplicatedStorage.Packages["vfx-module"]) -- Serves for initialization for both the controller and -- the service depending where it's called.
local VfxService = Knit.GetService("VfxService")
local VfxController = Knit.GetController("VfxController")

Configuration

A file called VfxModule.config.lua is to be created in ReplicatedStorage/Shared/Configs.

return table.freeze({ TemplateVfx = { ["callback"] = function(origin) print("hello") end, ["sanityCheck"] = function() return true end, } })

Explanation:

  • TemplateVfx: The name of the VFX (its identifier.)

  • callback: A function that's called when triggering the vfx.

  • sanityCheck: A function that runs to make sure the vfx should indeed be played for all other players or if it's triggered by a cheat. must return true for the vfx to play.

Usage

Events

  • OnVfxPlay: Triggers to the server when a client attempt to play a vfx and sent to all clients if the server approves the triggering.

Methods

Client Side

Explanation

  • vfxName: The name of the vfx to play.

  • origin: The origin of the vfx (can be anything, it all depends on your callback function from the config)


Controller:PlayVFXCallback("TestVFX", workspace.Character.RootPart)

    Client Side

    Explanation

    • folder: The folder of the vfx to play.

    • origin: The origin of the vfx (BasePart)

    • particleAmount: The amount of particle that should emit from the emitters inside the folders


    Controller:TriggerAllEmittersInFolder(workspace.VFXFolder, workspace.Character.RootPart, 25)
      Last modified: 05 December 2024