Setup
Initialization
First, we need to initialize the emit module on each client. The code below assumes you have the module inside ReplicatedStorage like this:
Module Setup
- ReplicatedStorage
- ForgeVFX
You can place this code inside a LocalScript in StarterPlayerScripts.
forge_init.client.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local vfx = require(ReplicatedStorage.ForgeVFX)
vfx.init()
Detecting key presses
The code below emits the ‘Explosion’ effect inside the ‘VFX’ folder in ReplicatedStorage.
forge_init.client.luau
local UserInputService = game:GetService("UserInputService")
local Effects = ReplicatedStorage:WaitForChild("VFX")
local EMIT_KEY = Enum.KeyCode.E
UserInputService.InputBegan:Connect(function(input, ignore)
if ignore or input.KeyCode ~= EMIT_KEY then
return
end
-- Now emit whatever effects you want
vfx.emit(Effects.Explosion)
end)
Last updated on