Skip to content

Instantly share code, notes, and snippets.

View mvyasu's full-sized avatar
😪
Tired

Yasu Yoshida mvyasu

😪
Tired
View GitHub Profile
@mvyasu
mvyasu / themeProvider.lua
Created May 24, 2022 23:30
A very simple theme provider for Fusion. It lacks some useful features, but it's merely an example.
local DEFAULT_THEME = "NAME_OF_THEME"
local Fusion = require(PATH_TO_FUSION)
local Value = Fusion.Value
type themeState = Fusion.StateObject<any>?
type theme = {
{[any]: any}
}
@mvyasu
mvyasu / ProximityPromptHighlight.lua
Last active April 17, 2026 19:52
A very simple script that highlights objects with ProximityPrompts inside them.
--by @mvyasu
--June 2 2022
local ProximityPromptService = game:GetService("ProximityPromptService")
local Players = game:GetService("Players")
local highlightLookupDictionary = {}
ProximityPromptService.PromptShown:Connect(function(promptInstance)
if not highlightLookupDictionary[promptInstance] then
@mvyasu
mvyasu / Ripple.lua
Last active June 26, 2022 15:18
A basic Fusion (v0.2) component that mimics a water ripple.
local Packages = game:GetService("ReplicatedStorage"):WaitForChild("Packages")
local Fusion = require(Packages.Fusion)
local Cleanup = Fusion.Cleanup
local Hydrate = Fusion.Hydrate
local Children = Fusion.Children
local Computed = Fusion.Computed
local Tween = Fusion.Tween
local Value = Fusion.Value
local New = Fusion.New
@mvyasu
mvyasu / StickyPlatforms.lua
Last active July 14, 2022 21:15
A simple snippet that attaches the local character to moving platforms that move without physics.
local STICKY_PLATFORM_TAG = "StickyPlatform"
local DISTANCE_TO_CHECK_BELOW = 15
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local Player = game:GetService("Players").LocalPlayer
local lastPlatformCFrame = nil
RunService.Heartbeat:Connect(function()
if not Player.Character then
@mvyasu
mvyasu / Cleanup.lua
Last active February 17, 2024 19:28
A simple cleanup function
local function cleanupObject(object: any)
local t = typeof(object)
if t == "function" then
object()
elseif t == "RBXScriptConnection" then
object:Disconnect()
elseif t == "table" or t =="Instance" then
if object.Destroy then
object:Destroy()
else
@mvyasu
mvyasu / HideCharacters.lua
Last active February 27, 2025 22:22
A quick and easy way to hide characters by setting attributes. If you want this to work with StreamingEnabled, you should handle the tagging of characters with a server script instead of with the provided snippet at the bottom.
--by @mvyasu
--4 May 2023
--A quick and easy way to hide characters by setting attributes
--To change whether characters are hidden do: game.Players:SetAttribute("HideCharacters", true)
--To exclude a player's character from being hidden do: game.Players.LocalPlayer:SetAttribute("NeverHideCharacter", true)
local CHARACTER_TAG = game:GetService("HttpService"):GenerateGUID()
local CollectionService = game:GetService("CollectionService")
@mvyasu
mvyasu / VirtualScroller.lua
Last active June 27, 2024 19:46
A component made for Fusion that is a ScrollingFrame that allows extremely large numbers of elements to exist with better performance
-- originally by @boatbomber
-- modified by @mvyasu
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fusion = require(ReplicatedStorage.Fusion)
local unwrap = require(ReplicatedStorage.Fusion.State.unwrap)
local Children = Fusion.Children
local ForPairs = Fusion.ForPairs
@mvyasu
mvyasu / studioThemeProvider.lua
Last active August 7, 2023 03:23
A simple studio theme provider that can be used for plugins made with Fusion
--!strict
local Plugin = script:FindFirstAncestorWhichIsA("Plugin")
local Packages = script.Parent.Parent.Packages
local Fusion = require(Packages.Fusion)
local Studio = settings().Studio
local Computed = Fusion.Computed
local Value = Fusion.Value
@mvyasu
mvyasu / CameraSubjectLocalTransparency.lua
Last active October 28, 2022 00:40
A simple LocalScript that will hide the player's character when they zoom into the current CameraSubject if it isn't a humanoid.
--CameraSubjectLocalTransparency
--by @mvyasu
local HIDE_CHARACTER_WHEN_DISTANCE_IS_LESS_THAN = 5
local SHOULD_TWEEN_TRANSPARENCY = false
local TRANSPARENCY_TWEEN_INFO = TweenInfo.new(1)
local TweenService = game:GetService("TweenService")
@mvyasu
mvyasu / Celestial.lua
Last active October 29, 2022 23:24
A small module that contains some useful functions for manipulating celestial bodies.
--!strict
local atan2 = math.atan2
local sqrt = math.sqrt
local circleCircumference = math.pi*2
local function getGeoTimeForPointDirection(pointDirection: Vector3, longitudeFactor: number?): (number, number)
local realLongitudeFactor = longitudeFactor or -1