DistanceFade - A transparency falloff effect for your games

thanks! which folder are you talking about?

Sorry, I forgot to mention!

I’m using the HexagonBarrier template, I meant getting the children of the Model that all the parts are parented to so they don’t have to be individually listed in the script.

I’ve made a working prototype which implements parallax mapping to add a couple more options to the module, including a positional offset. And it looks pretty cool.



The download for the additions I made:
DistanceFadeParallax.rbxm (18.0 KB)
DistanceFadeHexagonParallax.rbxm (25.2 KB)

6 Likes

SO COOL!! i’ll link it in the post

3 Likes

The way the module’s set up AddFace needs to be called for each part, so you need to loop through the children to add them. You could make a function to simplify the process

local function AddFaces(model)
	for _,d in model:GetDescendants() do
		if d:IsA("BasePart") then distanceFade:AddFace(d, Enum.NormalId.Front) end
	end
end

Also in the hexagon template, each face has a different horizontal texture offset applied to it to make the texture seamless, which is why they’re listed out like that

1 Like

could you make it work for multiple instances?

you mean have multiple Runservice for different instances?

Hey, the hexagon module literally just doesn’t work for me. The local script is in StarterPlayerScripts with the module inside it, and the BorderObject is just a union in a series of folders in workspace. For some reason the module just doesn’t work at all. What did I do wrong?

I forgot the script:

local DistanceFade = require(script.DistanceFade)
local ForcefieldObject = DistanceFade.new()

local BorderObject = game.Workspace.MapObjects.Forest.Misc:WaitForChild("WorldBorder", 5)

local ForcefieldSettings = {
	["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,
}

ForcefieldObject:UpdateSettings(ForcefieldSettings)

ForcefieldObject:AddFace(BorderObject, Enum.NormalId.Front)
ForcefieldObject:AddFace(BorderObject, Enum.NormalId.Back)
ForcefieldObject:AddFace(BorderObject, Enum.NormalId.Left)
ForcefieldObject:AddFace(BorderObject, Enum.NormalId.Right)

game:GetService("RunService").Heartbeat:Connect(function()
	local TargetPosition
	ForcefieldObject:Step(TargetPosition)
end)

it has to be a script w/ the Client on the RunContext

image

That’s what is shows for me.
image

does the Parent need to be Workspace?

What do you mean does the parent need to be workspace

This here in his screen shot of the properties

Mine’s in StarterPlayerScripts. Does it have to be in workspace?

I’m pretty sure I did everything right and it just doesn’t work. It somehow worked on the preset with the square texture but this preset doesn’t

1 Like

did you try using the hex model he provided?

1 Like

Yup, that didn’t work either. (chars chars)

1 Like

ok, I am going to try it also and will let u all know

works fine…

1 Like

K, thanks. (chars chars chars)

1 Like

Is this why it isn’t working? This is the part im referencing:
image

1 Like