DistanceFade - A transparency falloff effect for your games

Ok, I’ll try it out and let you know if it works.

1 Like

also if you look at the transparent parts template file you’ll see how I applied the effect to all the faces on each part

It yet again isn’t working.
image

local DistanceFade = require(script.DistanceFade)

-- initiate a new distancefade using .new() constructor
local distanceFade = DistanceFade.new()
local distanceFadeSettings = {
	["DistanceOuter"] = 36,
	["DistanceInner"] = 4,
	["EffectRadius"] = 20,
	["EffectRadiusMin"] = 16,
	["EdgeDistanceCalculations"] = true,
	["Texture"] = "rbxassetid://18852397345",
	["TextureTransparency"] = 0.65,
	["BackgroundTransparency"] = 0.9,
	["TextureColor"] = Color3.fromRGB(255, 0, 4),
	["BackgroundColor"] = Color3.fromRGB(255, 0, 4),
	["TextureSize"] = Vector2.new(20, 16),
	["TextureOffset"] = Vector2.new(10, 4),
	["Brightness"] = 3,
}
-- update distancefade with initial customization settings
distanceFade:UpdateSettings(distanceFadeSettings)

-- add faces to apply the effect to
local folder = script.Parent

distanceFade:AddFace(folder:WaitForChild("Wall1"), Enum.NormalId.Back)
distanceFade:AddFace(folder:WaitForChild("Wall2"), Enum.NormalId.Back)
distanceFade:AddFace(folder:WaitForChild("Wall3"), Enum.NormalId.Back)
distanceFade:AddFace(folder:WaitForChild("Wall4"), Enum.NormalId.Back)

game:GetService("RunService").Heartbeat:Connect(function() -- using Heartbeat for Step() is visually smoother than RenderStepped
	-- call Step() for each distancefade. If arguments are left empty, it automatically targets local character's root part
	distanceFade:Step()
end)

Am I missing something or did I do sometyhing wrong?

I even made sure each face was correct by using a decal

your parts need to be under the model, not the script , I think…

They are under the model (chars chars)

ok im gonna test this idk why its not working

I’m not a very good scripter so I might have made a mistake, that’s why I need help figuring it out.

all good man its how you learn :slight_smile:

For your ‘HexagonBarrier’, what did you use to get the parts at and angle and edged right next to each other?

In theory you could build a long sections and curve them at different angle to make a curvy barrier , correct?.. know of any way of automating it? like a splines to parts script or something?

image

You can use the Archimedes plugin, that’s how I originally did it, but now I just resorted to 4 parts in a square. It still doesn’t work though :tired_face:

1 Like

Im sure there’s a plugin or script to do it faster, I just had a child and parent part, moved the child part so it’s edge is in the center of the parent part, then rotated the parent part. Or just use models and set the pivot to the edge of the part

Version 2.0, DistanceFade barrier drawer tool… :slight_smile:

Have you figured out what’s wrong with my script yet?

I recreated your setup/script and it worked fine for me, just make sure if the script is in the workspace, it’s a normal script with runcontext set to client, and if the script is in the starterplayer or startercharacter, it’s a localscript

if you want to send the rbxm file of your model I can test that out too

Sure thing. Ill send it over. (Chars chars)

Place1.rbxl (70.2 KB)

ah I see, the parts are just out of range so the effect isn’t showing up. the target position needs to be in range of the part for the effect to appear (range is modified using the distanceouter and distanceinner settings)
image

What do reccomend I should set it to?