Skip to main content

rain

Rain module by builthomas, heavily modified and refactored by bubshurb.

Types

CollisonModeFunction

type CollisonModeFunction = ((basePartBasePart) → boolean)?

A predicate which is called automatically and is passed a base part as the only argument.

  • If the predicate returns a truthy value, then the rain will hit the given base part.

  • If the predicate returns a non truthy value, then the rain will NOT hit the given basepart.

CollisionMode

interface CollisionMode {
callback3?
blacklist2?
whitelist1
none0
}
  • If rain.CollisionMode.whitelist is passed as the first argument to rain.SetCollisionMode, you can pass in a base part or an array of base parts to be hit by the rain only.

  • If rain.CollisionMode.blacklist is passed as the first argument to rain.SetCollisionMode, you can pass in a base part or an array of base parts to NOT be hit by the rain.

  • If rain.CollisionMode.callback is passed as the first argument to rain.SetCollisionMode, you can pass in a predicate [`CollisionModeFunction`] that can return a boolean value.

Properties

enabled

rain.enabled: Property

A Property object that contains a value on whether the rain is enabled or not.

Functions

enable

rain.enable(tweenInfoTweenInfo?) → ()

Enables the rain.

disable

rain.disable(tweenInfoTweenInfo?) → ()

Disables the rain.

setColor

rain.setColor(
valueColor3,
tweenInfoTweenInfo?
) → ()

Sets the rain color.

color

rain.color() → ()

Returns the current rain color value.

transparency

rain.transparency() → ()

Returns the current rain transparency value.

ceiling

rain.ceiling() → ()

Returns the current rain ceiling value.

setTransparency

rain.setTransparency(transparencynumber) → ()

Sets the transparency of the rain.

setTransparency

rain.setTransparency(speedRationumber) → ()

Sets the speed ratio of the rain.

setTransparency

rain.setTransparency(intensityRationumber) → ()

Sets the intensity ratio of the rain.

setTransparency

rain.setTransparency(lightEmissionnumber) → ()

Sets the light emission of the rain.

setTransparency

rain.setTransparency(lightInfluencenumber) → ()

Sets the light influence of the rain.

setVolume

rain.setVolume(
volumenumber,
tweenInfoTweenInfo?
) → ()

Sets the volume of the rain sound.

setSoundGroup

rain.setSoundGroup(newSoundGroupSoundGroup) → ()

Sets the sound group of the rain sound by first cloning a copy of it, and then setting the cloned variant's sound group to newSoundGroup, and the old variant is destroyed.

direction

rain.direction() → Vector3

Returns the direction of the rain.

setDirection

rain.setDirection(
directionVector3,
tweenInfoTweenInfo?
) → ()

Sets the direction of the rain.

setCeiling

rain.setCeiling(ceilingnumber) → ()

Sets the ceiling of the rain.

setStraightTexture

rain.setStraightTexture(assetstring) → ()

Sets the straight texture of the rain.

setTopDownTexture

rain.setTopDownTexture(assetstring) → ()

Sets the top down texture of the rain.

setSplashTexture

rain.setSplashTexture(assetstring) → ()

Sets the splash texture of the rain.

setSoundId

rain.setSoundId(assetstring) → ()

Sets the sound id of the rain sound.

setConfig

rain.setConfig(config{
ceilingnumber?,
intensityRationumber?,
directionVector3?,
splashTexturestring?,
topDownTexturestring?,
volumenumber?,
straightTexturestring?,
soundIdstring?,
transparencynumber?,
lightEmissionstring?,
lightInfluencestring?,
colorColor3?,
speedRationumber?,
collisionModestring,
collisionModeFunctionCollisonModeFunction?,
}) → ()

Sets the rain config.

setCollisionMode

rain.setCollisionMode() → ()

Sets the rain collision mode.

-- Example uses:

-- 1)
rain.setCollisionMode(rain.CollisionMode.callback, function(basePart)
	return not basePart.CanCollide
end)

-- 2)
rain.setCollisionMode(rain.CollisionMode.whitelist, {Workspace.Baseplate})

-- 3)
rain.setCollisionMode(rain.CollisionMode.blacklist, {Workspace.Baseplate})
Show raw api
{
    "functions": [
        {
            "name": "enable",
            "desc": " \nEnables the rain.",
            "params": [
                {
                    "name": "tweenInfo",
                    "desc": "",
                    "lua_type": "TweenInfo?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 786,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "disable",
            "desc": " \nDisables the rain.",
            "params": [
                {
                    "name": "tweenInfo",
                    "desc": "",
                    "lua_type": "TweenInfo?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 830,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setColor",
            "desc": " \nSets the rain color.",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "Color3"
                },
                {
                    "name": "tweenInfo",
                    "desc": "",
                    "lua_type": "TweenInfo?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 863,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "color",
            "desc": " \nReturns the current rain color value.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 884,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "transparency",
            "desc": " \nReturns the current rain transparency value.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 892,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "ceiling",
            "desc": " \nReturns the current rain ceiling value.",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 900,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setTransparency",
            "desc": " \n\nSets the transparency of the rain.",
            "params": [
                {
                    "name": "transparency",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 945,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setTransparency",
            "desc": " \n\nSets the speed ratio of the rain.",
            "params": [
                {
                    "name": "speedRatio",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 955,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setTransparency",
            "desc": " \n\nSets the intensity ratio of the rain.",
            "params": [
                {
                    "name": "intensityRatio",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 965,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setTransparency",
            "desc": " \n\nSets the light emission of the rain.",
            "params": [
                {
                    "name": "lightEmission",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 975,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setTransparency",
            "desc": " \n\nSets the light influence of the rain.",
            "params": [
                {
                    "name": "lightInfluence",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 985,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setVolume",
            "desc": " \nSets the volume of the rain sound.",
            "params": [
                {
                    "name": "volume",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "tweenInfo",
                    "desc": "",
                    "lua_type": "TweenInfo?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 991,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setSoundGroup",
            "desc": " \nSets the sound group of the rain sound by first cloning a copy of it, and then setting the cloned variant's sound\ngroup to `newSoundGroup`, and the old variant is destroyed.",
            "params": [
                {
                    "name": "newSoundGroup",
                    "desc": "",
                    "lua_type": "SoundGroup"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1013,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "direction",
            "desc": " \nReturns the direction of the rain.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Vector3\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1023,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setDirection",
            "desc": " \nSets the direction of the rain.",
            "params": [
                {
                    "name": "direction",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "tweenInfo",
                    "desc": "",
                    "lua_type": "TweenInfo?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1031,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setCeiling",
            "desc": " \nSets the ceiling of the rain.",
            "params": [
                {
                    "name": "ceiling",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1066,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setStraightTexture",
            "desc": " \nSets the straight texture of the rain.",
            "params": [
                {
                    "name": "asset",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1078,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setTopDownTexture",
            "desc": " \nSets the top down texture of the rain.",
            "params": [
                {
                    "name": "asset",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1097,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setSplashTexture",
            "desc": " \nSets the splash texture of the rain.",
            "params": [
                {
                    "name": "asset",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1116,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setSoundId",
            "desc": " \nSets the sound id of the rain sound.",
            "params": [
                {
                    "name": "asset",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1133,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setConfig",
            "desc": " \nSets the rain config.",
            "params": [
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "{\n\tceiling: number?,\n\tintensityRatio: number?,\n\tdirection: Vector3?,\n\tsplashTexture: string?,\n\ttopDownTexture: string?,\n\tvolume: number?,\n\tstraightTexture: string?,\n\tsoundId: string?,\n\ttransparency: number?,\n\tlightEmission: string?,\n\tlightInfluence: string?,\n\tcolor: Color3?,\n\tspeedRatio: number?,\n\tcollisionMode: string,\n\tcollisionModeFunction: CollisonModeFunction?,\n}"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1145,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "setCollisionMode",
            "desc": " \n\nSets the rain collision mode. \n\n```lua\n-- Example uses:\n\n-- 1)\nrain.setCollisionMode(rain.CollisionMode.callback, function(basePart)\n\treturn not basePart.CanCollide\nend)\n\n-- 2)\nrain.setCollisionMode(rain.CollisionMode.whitelist, {Workspace.Baseplate})\n\n-- 3)\nrain.setCollisionMode(rain.CollisionMode.blacklist, {Workspace.Baseplate})\n```",
            "params": [
                {
                    "name": "mode",
                    "desc": "",
                    "lua_type": "CollisionMode"
                },
                {
                    "name": "param",
                    "desc": "",
                    "lua_type": "{ Instance } | Instance | CollisonModeFunction"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 1258,
                "path": "src/rain/init.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "enabled",
            "desc": " \n\nA [Property](https://babypatrick100.github.io/libraries/api/Property/) object that contains a value on whether the rain is enabled or not.",
            "lua_type": "Property",
            "source": {
                "line": 1360,
                "path": "src/rain/init.luau"
            }
        }
    ],
    "types": [
        {
            "name": "CollisonModeFunction",
            "desc": "A predicate which is called automatically and is passed a base part as the only\nargument. \n\n- If the predicate returns a *truthy* value, then the rain will hit the given\nbase part.\n\n- If the predicate returns a non *truthy* value, then the rain will NOT\nhit the given basepart.",
            "lua_type": "((basePart: BasePart) -> boolean)?",
            "source": {
                "line": 374,
                "path": "src/rain/init.luau"
            }
        },
        {
            "name": "CollisionMode",
            "desc": "- If `rain.CollisionMode.whitelist` is passed as the first argument to [rain.SetCollisionMode], you can pass in a base part or an array of base parts\nto be hit by the rain **only**.\n\n- If `rain.CollisionMode.blacklist` is passed as the first argument to [rain.SetCollisionMode], you can pass in a base part or an array of base parts\nto NOT be hit by the rain.\n\n- If `rain.CollisionMode.callback` is passed as the first argument to [rain.SetCollisionMode], you can pass in a predicate [`CollisionModeFunction`]\nthat can return a boolean value.",
            "fields": [
                {
                    "name": "callback",
                    "lua_type": "3?",
                    "desc": ""
                },
                {
                    "name": "blacklist",
                    "lua_type": "2?",
                    "desc": ""
                },
                {
                    "name": "whitelist",
                    "lua_type": "1",
                    "desc": ""
                },
                {
                    "name": "none",
                    "lua_type": "0",
                    "desc": ""
                }
            ],
            "source": {
                "line": 1237,
                "path": "src/rain/init.luau"
            }
        }
    ],
    "name": "rain",
    "desc": "Rain module by builthomas, *heavily modified and refactored by bubshurb*.",
    "source": {
        "line": 6,
        "path": "src/rain/init.luau"
    }
}