Home / Lua / Client / ClientEffect / Static Functions / Create


Returns    ClientEffect
Prototype    ClientEffect.Create(table arguments)
Description    No description

Argument table

Required values

Type Name Notes
Vector3 position
Angle angle
number effect_id From 0 to 467. Use this effects browser to find effect ids.

Examples

Create an explosion where you click

effects = {}

Events:Subscribe("MouseDown", function(args)
	if args.button ~= 1 then
		return
	end
	
	local result = Physics:Raycast(
		Camera:GetPosition(),
		Camera:GetAngle() * Vector3.Forward,
		0,
		100
	)
	
	local effect = ClientEffect.Create{
		position = result.position + result.normal * 0.25,
		angle = Angle(),
		effect_id = 35,
	}
	
	table.insert(effects, effect)
end)

-- Make sure to clean up everything on ModuleUnload.
Events:Subscribe("ModuleUnload", function()
	for index, effect in ipairs(effects) do
		effect:Remove()
	end
end)