Small Ability Snippet
if (name == "LightningBeam" and actionCheck(values)) then
print("BeamFired")
attack(character, 10, 0.5, 150, Animations.Mantra["LightningBeam"], 0, 10, 0.5, 0.3, 0.4, "ElectricShock", "ElectricHit", 0.2, false, false, false, -15)
local lightningBeam = rs.Particles.LightningBeam:Clone()
local leftArm = character:FindFirstChild("Left Arm") or character:FindFirstChild("LeftArm")
if leftArm then
lightningBeam.Parent = leftArm
-- Recursive function to weld all descendants
local function weldDescendants(part, parent)
for _, descendant in ipairs(part:GetDescendants()) do
if descendant:IsA("BasePart") then
local weld = Instance.new("Weld")
weld.Part0 = parent
weld.Part1 = descendant
weld.C0 = parent.CFrame:inverse() * descendant.CFrame
weld.Parent = parent
end
end
end
-- Weld the main part and all descendants
local mainWeld = Instance.new("Weld")
mainWeld.Part0 = leftArm
mainWeld.Part1 = lightningBeam
mainWeld.C0 = CFrame.new(0, 0, 0) -- Adjust this CFrame to position the LightningBeam as needed
mainWeld.Parent = leftArm
weldDescendants(lightningBeam, lightningBeam)
-- Ensure the attachments are parented correctly to the cloned LightningBeam part
for _, attachment in ipairs(lightningBeam:GetChildren()) do
if attachment:IsA("Attachment") then
attachment.Parent = lightningBeam
end
end
-- Emit particle effects if any
if lightningBeam:FindFirstChildOfClass("ParticleEmitter") then
lightningBeam:FindFirstChildOfClass("ParticleEmitter"):Emit(1)
end
Debris:AddItem(lightningBeam, 2)
else
warn("Left Arm not found!")
end
end
end)
Made this ability with my base understanding of front end VFX production with scripting, and a bit of AI, so its really not that good, but essentially I have a part in replicated storage, with 2 attachments in it, these attachments contain the VFX including particles and a beam, when the ability is fired, attack(character, 10, 0.5, 150, Animations.Mantra["LightningBeam"], 0, 10, 0.5, 0.3, 0.4, "ElectricShock", "ElectricHit", 0.2, false, false, false, -15)
works fine based on a previous function, however I want the beam I have in replicated storage to weld to the players arm, and shoot forward, but have been unsuccessful thus far, any help would be awesome!