Convert To Shadow - A plugin to convert models or objects into just shadows

Get Convert To Shadow here: https://www.roblox.com/library/72083848011269/

Forgot to show but to unshadow it you just hit the plugin button again!

Not all but majority of materials are supported, some like neon, glass might not work until i find a way to shadow them.

Not sure of the full use cases of this but i guess custom shadows mainly? maybe some builders can get creative using this!.

SOURCE: (I WOULD RECOMMEND NOT USING THE SOURCE IF U PLAN ON GETTING UPDATES!)

--[[	
	CONVERT TO SHADOW! - Plugin scripted by Scream (scr.eam on DC)

	Currently some materials are unsupported until i find a way to shadow them,
	I know that I'm using some deprecated code, i can never find myself ending my code with
	a double end it triggers me in a way that I can hardly explain hopefully someone in the world relates.
]]

--// Services
local Selection = game:GetService("Selection")

--// Variables
local Toolbar = plugin:CreateToolbar(
	"Shadow Maker"
)
local Button = Toolbar:CreateButton(
	"Convert To Shadow", 
	"Converts the selected part or model into just a shadow if it has one.", 
	"rbxassetid://219103757"
)
local BlacklistedTypes, BlacklistedMaterials = {
	"LocalScript",
	"Script",
}, {
	Enum.Material.Glass,
	Enum.Material.Neon
}

--// Plugin
local function ShadowObject(_, Object)
	local CanShadowObject = pcall(function() _ = Object.Transparency end)
	
	if not CanShadowObject then return end
	
	local Shadowed = Object:GetAttribute("IsShadowed")
	
	if Shadowed then
		Object.Transparency = Shadowed
		Object:SetAttribute("IsShadowed", nil)
		return
	end

	local HasMaterial = pcall(function() _ = Object.Material end)

	if HasMaterial and table.find(BlacklistedMaterials, Object.Material) then
		Object:SetAttribute("IsShadowed", Object.Transparency)
		Object.Transparency = 1
		return
	end
	
	Object:SetAttribute("IsShadowed", Object.Transparency)
	Object.Transparency = math.huge
end

local function ShadowMain(_, Object)
	if table.find(BlacklistedTypes, Object.ClassName) then return end

	local ShadowHighlight = Object:FindFirstChild("ShadowHighlight")

	if not ShadowHighlight then
		local Highlight = Instance.new("Highlight")
		Highlight.Name = "ShadowHighlight"
		Highlight.Enabled = false
		Highlight.Parent = Object
	else
		ShadowHighlight:Destroy()
	end
	
	for _, Descendant in next, Object:GetDescendants() do
		ShadowObject(_, Descendant)
	end

	ShadowObject(_, Object)
end

Button.Click:Connect(function()
	local SelectedInstances = Selection:Get()
	
	table.foreach(SelectedInstances, ShadowMain)
end)
9 Likes

All good but 1 error

I have no idea how you figured this technique out, but it’s amazing. I can imagine some interesting puzzle games based off this entirely!

Why is this highlight being created? It seems to “toggle” being destroyed or created, but it’s never visible and it’s regardless of if an object is shadowed or not.

2 Likes

link does not have access

highlight is actually apart of how it all works, without the highlight the shadow wont exist.

i noticed that with how I’m doing the objects, if u were to select the model / object then the shadow would be visible but when u unselected it the shadow was gone, putting in a highlight instance would solve that, you could actually test this by shadowing a part with my plugin, opening the instance and delete the highlight then hover over and off of the part

Sorry I’ve forgot to put it on for distribution, done! sorry about that.

Fixed, sorry about that i forgot to put it out :sob: .

This reminds me of a popular shadow-based obby that was created a few years ago. This is cool stuff.

1 Like