local Player = game.Players.LocalPlayer local Character = Player.Character repeat Character.Arm1.ControlStone.Beam.Transparency = Character.Arm1.ControlStone.Beam.Transparency - 0.05 until Character.Arm1.ControlStone.Beam.Transparency == 1
i tried this and it told me "attempt to perform arithmetic on field 'Transparency' (a userdata value)
Transparency from Unions, MeshParts, and other kinds of geometry are floats while Transparency on Beams and Trails are Number Sequences. To be honest, you can actually set them up manually by clicking on the Transparency property, then clicking the 3-dotted button to its right. Add nodes by clicking anywhere (in this case, lowest on the start and highest on the end) on the graph sequence (that's what I call it). Higher values means less opacity while lower values means less transparency.
If you want to put it in a script, then use the NumberSequence, and NumberSequenceKeypoint as shown here (copy if you want):
local Player = game.Players.LocalPlayer local Character = Player.Character numseq = {NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,1)} NS = NumberSequence.new(numseq) Character.Arm1.ControlStone.Beam.Transparency = NS
I tried this and it is all fine (tested with Beam instance in Workspace, Script in Workspace.)
Hope this fixed your issue.
EDIT: If you want both sides to fade then try this:
local Player = game.Players.LocalPlayer local Character = Player.Character gradual = 140 -- Smoothness of transition. May be performance hungry but idk. waittime = 0.006 -- Speed of transition. Slower at high values and faster at lower values. for i = 1, gradual do wait(waittime) numseq = {NumberSequenceKeypoint.new(0,i/gradual),NumberSequenceKeypoint.new(1,i/gradual)} NS = NumberSequence.new(numseq) Character.Arm1.ControlStone.Beam.Transparency = NS end
Again, hope this fixed your issue.
Really sorry for the numerous edits because of mistakes.
You can use TweenService for this, TweenService functions like a lerp, but you can also apply EasingStyles and EasingDirections
local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut) local part = Instance.new('Part') local goal = {} goal.Transparency = 1 local tween = game:GetService('TweenService'):Create(part,tweenInfo,goal) tween:Play()
It also should be noted that you can put more/less info into your TweenInfo if you want, ex.
local infoOne = TweenInfo.new(1) local infoTwo = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut, 2, true, 0.5)
For more info on what each argument does, go here.
EDIT: Since you need Number Sequences, you can do something like this.
local tweenInfo = TweenInfo.new(1,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut) local part -- make this equal to what you want to change the transparency of local val = Instance.new('NumberValue',script) val.Value = 0 local goal = {} goal.Value= 1 local tween = game:GetService('TweenService'):Create(val,tweenInfo,goal) local function OnChanged() part.Transparency = NumberSequence.new(val.Value) end val.Changed:Connect(OnChanged) tween:Play()
You can use a loop for your answer.
local Player = game:GetService("Players").LocalPlayer local Character = Player.Character for i=0.05, 20 do Character.Arm1.ControlStone.Beam.Transparency = Character.Arm1.ControlStone.Beam.Transparency - i wait(0.1) end