Custom Highlight Forcefield

So I don’t usually release scripts, and I’m pretty sure mine isn’t as efficient as it could be, but here ya go!

If you dont wanna change the path just simply create a folder in ReplicatedStorage called “Assets”, another folder inside the Assets folder called “ForceField” then add a highlight in there with the name “ForceFieldCustom”

local ff = script.Parent:WaitForChild("ForceField")
local ff2 = game.ReplicatedStorage.Assets.ForceField.ForceFieldCustom
local tween = game:GetService("TweenService")
ff.Visible = false


local ff2Clone = ff2:Clone()
ff2Clone.Parent = script.Parent

local blinkTween = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	0,
	false
)

local blinkTweenIn = tween:Create(ff2Clone, blinkTween, {FillTransparency = 0.5, OutlineTransparency = 1})
local blinkTweenOut = tween:Create(ff2Clone, blinkTween, {FillTransparency = 0.2, OutlineTransparency = 0})
local repeatCount = 10


repeat
	blinkTweenIn:Play()
	blinkTweenIn.Completed:Wait()
	
	blinkTweenOut:Play()
	blinkTweenOut.Completed:Wait()
	repeatCount = repeatCount - 1
until repeatCount == 0

ff2Clone:Destroy()
ff:Destroy()


4 Likes

Improved version (FillTransparency should be 0.2):

local ff = script.Parent:WaitForChild("ForceField")
local ff2 = game.ReplicatedStorage.Assets.ForceField.ForceFieldCustom
local tween = game:GetService("TweenService")
ff.Visible = false


local ff2Clone = ff2:Clone()
ff2Clone.Parent = script.Parent

local repeatCount = 10

local blinkTween = TweenInfo.new(
	0.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.InOut,
	repeatCount,
	true
)

local blinkTween = tween:Create(ff2Clone, blinkTween, {FillTransparency = 0.5, OutlineTransparency = 1})

blinkTween:Play()
blinkTween.Completed:Wait()

ff2Clone:Destroy()
ff:Destroy()

(Correct me if theres any errors)

1 Like

nice and simple script, this has potential, you could release a module for this where you can customize the highlight’s propreties

1 Like

Customize how? Like different color, or the fill transparencies, things like that?

1 Like

yea, but even thought the highlight properties are limited, they can still working on an alternative forcefield that lets you customize animations with particle emitter, beams, trails, roblox effects, etc…

1 Like

Might dabble with some of these customizations. Thanks! :smiley:

3 Likes

No errors what so ever, and looks a lot cleaner compared to my previous code. Thanks! :slight_smile:

1 Like

Wouldn’t this make the previous 0.2 duration now 0.5?

Specifically this part:

Also, just a minor adjustment, but you should add a reference to ReplicatedStorage at the top, like this:

--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
1 Like

You’re right, but if you know what you’re doing you can always tweak the settings, however I’m currently working on making this into a module to make it easier for those who don’t know about scripting, and want to customize this. I’m taking @ImNotch_XVI’s ideas into consideration aswell with experimenting with different animation types, material types like forcefield, and any other idea that floats around on this post, or just in my noggin lol.

1 Like