I have a card in my game in which once the player select it, it duplicates the amount of sword the player possess. So for example if I have 2 swords that means that my first sword is going to do his animation and the second sword will do the same animation on top of the first sword.
What I want to reproduce is the effect right below in the video from a game called Become OP
So basically I tried already 5 differents code to give me the result I want which none of them led to success and I’m out of ideas
Code #1
This duplicate the sword
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Star = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("Star"))
local SelectCard = Remotes:WaitForChild("SelectCard")
local AttributeAbility = Remotes:WaitForChild("AttributeAbility")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local swordModel = character:WaitForChild("Warrior Sword")
local handle = swordModel:WaitForChild("Handle")
local invisibleFillingPart = swordModel:WaitForChild("invisible filling part")
local debounceMonsters = {}
if not invisibleFillingPart then
warn("SHARP part is missing in the sword model!")
return
end
local healthUpdateEvent = ReplicatedStorage:WaitForChild("HealthUpdateEvent")
local WeaponController = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("WeaponController"))
local DAMAGE = 1
local radius = 5
local forwardOffset = 3
local stabDistance = 5
local stabTime = 3
local stabCooldown = 0.5
local speedStab = 2
local stabInterval = 3
local heightOffset = 2
local elapsedTime = 0
local isStabbing = false
local isStabbingEnded = false
local currentPosition = nil
local stabFinalOffset = nil
local stabFinalDirection = nil
local disappearSword = false
local forceStop = false
local function SmoothCurve(t)
return 1 - math.pow(1 - t, 3)
end
local function FindPoint(mouseRay, planeY)
local direction = mouseRay.Direction
local origin = mouseRay.Origin
if direction.Y == 0 then return nil end
local distance = (planeY - origin.Y) / direction.Y
return origin + direction * distance
end
local function UpdateSwordPosition(deltaTime)
if swordModel.PrimaryPart.Anchored then return end
if not player:FindFirstChild("IsPlaying") or not player.IsPlaying.Value then return end
if not character or not character.PrimaryPart then return end
local root = character.PrimaryPart.Position
local head = character:FindFirstChild("Head")
if not head then return end
local targetPosition = FindPoint(mouse.UnitRay, head.Position.Y)
if not targetPosition then return end
local horizontalTarget = Vector3.new(targetPosition.X, root.Y, targetPosition.Z)
local direction = (horizontalTarget - root).unit
if isStabbing and not isStabbingEnded then
if elapsedTime == 0 then
stabFinalDirection = direction
end
disappearSword = false
elapsedTime += deltaTime * speedStab
local progress = math.clamp(elapsedTime / stabTime, 0, 0.4)
local easedProgress = SmoothCurve(progress)
if progress >= 0.4 then
stabFinalOffset = swordModel.PrimaryPart.Position - root
isStabbing = false
isStabbingEnded = true
elapsedTime = 0
end
local swordPosition = root + stabFinalDirection * (radius + forwardOffset + easedProgress * stabDistance) + Vector3.new(0, heightOffset, 0)
currentPosition = swordPosition
swordModel:SetPrimaryPartCFrame(
CFrame.lookAt(swordPosition, swordPosition + stabFinalDirection)
* CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
)
for _, part in ipairs(invisibleFillingPart:GetTouchingParts()) do
if part.Name ~= "OtherGrip" then
if not debounceMonsters[part.Parent] then
debounceMonsters[part.Parent] = true
healthUpdateEvent:FireServer(DAMAGE, part.Parent)
task.wait(1)
debounceMonsters[part.Parent] = false
end
end
end
elseif not isStabbing and isStabbingEnded then
if stabFinalOffset and stabFinalDirection then
elapsedTime += deltaTime * speedStab
local progress = math.clamp(0.4 + (elapsedTime / stabTime), 0, 1)
local easedProgress = SmoothCurve(progress)
if progress >= 0.4 and not disappearSword then
disappearSword = true
WeaponController.Visible(player, swordModel, false)
end
local swordPosition = root + stabFinalDirection * (radius + forwardOffset + easedProgress * stabDistance) + Vector3.new(0, heightOffset, 0)
currentPosition = swordPosition
swordModel:SetPrimaryPartCFrame(
CFrame.lookAt(swordPosition, swordPosition + stabFinalDirection)
* CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
)
end
end
end
task.spawn(function()
while true do
task.wait(stabInterval)
WeaponController.Visible(player, swordModel, true)
isStabbing = true
isStabbingEnded = false
elapsedTime = 0
forceStop = false
end
end)
AttributeAbility.Event:Connect(function(abilityName)
if abilityName == "SwordAttackSpeed" then
if speedStab > 0.1 then
speedStab -= (speedStab * 0.1)
end
speedStab -= (speedStab * 0.1)
print("SWORD SPEED HAS INCREASED BY : ", speedStab)
elseif abilityName == "SwordAttackCooldown" then
if stabInterval > 0.1 then
stabInterval -= 0.1
end
print("SWORD COOLDOWN HAS DECREASED BY : ", stabInterval)
elseif abilityName == "SwordAttackscale" then
print("SWORD SCALING")
local GetScale = swordModel:GetScale()
local NewScale = GetScale + (GetScale * 0.1)
swordModel:ScaleTo(NewScale)
--ScaleSword:FireServer(NewScale)
elseif abilityName == "SwordAttack" then
print("SWORD ATTACK BOOST")
local numberStars = Star.PickStarCount()
print("NUMBER OF STARS IS : ", numberStars)
DAMAGE += 4
--ScaleSword:FireServer(NewScale)
elseif abilityName == "SwordAttackAdd" then
local CloneSwordModel = swordModel:Clone()
local offset = Vector3.new(3, 0, 0)
local newPosition = swordModel.PrimaryPart.Position + offset
CloneSwordModel:SetPrimaryPartCFrame(CFrame.new(newPosition))
CloneSwordModel.Parent = character
WeaponController.Visible(player, CloneSwordModel, true)
print(character:GetChildren())
end
end)
RunService.RenderStepped:Connect(UpdateSwordPosition)
Code #2
This start the animation on sword
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Star = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("Star"))
local SelectCard = Remotes:WaitForChild("SelectCard")
local AttributeAbility = Remotes:WaitForChild("AttributeAbility")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
-- Pour récupérer toutes les épées qui commencent par "Warrior Sword"
local function getAllSwords()
local swords = {}
for _, item in pairs(character:GetChildren()) do
if item.Name:match("^Warrior Sword") then
table.insert(swords, item)
end
end
return swords
end
local healthUpdateEvent = ReplicatedStorage:WaitForChild("HealthUpdateEvent")
local WeaponController = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("WeaponController"))
local DAMAGE = 1
local radius = 5
local forwardOffset = 3
local stabDistance = 5
local stabTime = 3
local stabCooldown = 0.5
local speedStab = 2
local stabInterval = 3
local heightOffset = 2
local elapsedTime = 0
local isStabbing = false
local isStabbingEnded = false
local currentPosition = nil
local stabFinalOffset = nil
local stabFinalDirection = nil
local disappearSword = false
local forceStop = false
local debounceMonsters = {}
local function SmoothCurve(t)
return 1 - math.pow(1 - t, 3)
end
local function FindPoint(mouseRay, planeY)
local direction = mouseRay.Direction
local origin = mouseRay.Origin
if direction.Y == 0 then return nil end
local distance = (planeY - origin.Y) / direction.Y
return origin + direction * distance
end
local function UpdateSwordPosition(deltaTime)
if not player:FindFirstChild("IsPlaying") or not player.IsPlaying.Value then return end
if not character or not character.PrimaryPart then return end
local root = character.PrimaryPart.Position
local head = character:FindFirstChild("Head")
if not head then return end
local targetPosition = FindPoint(mouse.UnitRay, head.Position.Y)
if not targetPosition then return end
local horizontalTarget = Vector3.new(targetPosition.X, root.Y, targetPosition.Z)
local direction = (horizontalTarget - root).unit
local swords = getAllSwords()
local swordCount = #swords
local angleStep = math.pi * 2 / swordCount -- Calculer l'angle entre chaque épée pour les espacer uniformément
for index, swordModel in pairs(swords) do
local invisibleFillingPart = swordModel:WaitForChild("invisible filling part")
if not invisibleFillingPart then
warn("SHARP part is missing in the sword model!")
return
end
if isStabbing and not isStabbingEnded then
if elapsedTime == 0 then
stabFinalDirection = direction
end
disappearSword = false
elapsedTime += deltaTime * speedStab
local progress = math.clamp(elapsedTime / stabTime, 0, 0.4)
local easedProgress = SmoothCurve(progress)
if progress >= 0.4 then
stabFinalOffset = swordModel.PrimaryPart.Position - root
isStabbing = false
isStabbingEnded = true
elapsedTime = 0
end
-- Calcul de la position circulaire autour du joueur pour chaque épée
local angle = angleStep * (index - 1) -- Angle de rotation pour chaque épée
local offsetX = math.cos(angle) * radius
local offsetZ = math.sin(angle) * radius
local swordPosition = root + stabFinalDirection * (radius + forwardOffset + easedProgress * stabDistance) + Vector3.new(offsetX, heightOffset, offsetZ)
currentPosition = swordPosition
swordModel:SetPrimaryPartCFrame(
CFrame.lookAt(swordPosition, swordPosition + stabFinalDirection)
* CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
)
for _, part in ipairs(invisibleFillingPart:GetTouchingParts()) do
if part.Name ~= "OtherGrip" then
if not debounceMonsters[part.Parent] then
debounceMonsters[part.Parent] = true
healthUpdateEvent:FireServer(DAMAGE, part.Parent)
task.wait(1)
debounceMonsters[part.Parent] = false
end
end
end
elseif not isStabbing and isStabbingEnded then
if stabFinalOffset and stabFinalDirection then
elapsedTime += deltaTime * speedStab
local progress = math.clamp(0.4 + (elapsedTime / stabTime), 0, 1)
local easedProgress = SmoothCurve(progress)
if progress >= 0.4 and not disappearSword then
disappearSword = true
WeaponController.Visible(player, swordModel, false)
end
-- Calcul de la position circulaire pour la fin de l'attaque
local angle = angleStep * (index - 1)
local offsetX = math.cos(angle) * radius
local offsetZ = math.sin(angle) * radius
local swordPosition = root + stabFinalDirection * (radius + forwardOffset + easedProgress * stabDistance) + Vector3.new(offsetX, heightOffset, offsetZ)
currentPosition = swordPosition
swordModel:SetPrimaryPartCFrame(
CFrame.lookAt(swordPosition, swordPosition + stabFinalDirection)
* CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
)
end
end
end
end
task.spawn(function()
while true do
task.wait(stabInterval)
local swords = getAllSwords()
for _, swordModel in pairs(swords) do
WeaponController.Visible(player, swordModel, true)
end
isStabbing = true
isStabbingEnded = false
elapsedTime = 0
forceStop = false
end
end)
AttributeAbility.Event:Connect(function(abilityName)
if abilityName == "SwordAttackSpeed" then
if speedStab > 0.1 then
speedStab -= (speedStab * 0.1)
end
print("SWORD SPEED HAS INCREASED BY : ", speedStab)
elseif abilityName == "SwordAttackCooldown" then
if stabInterval > 0.1 then
stabInterval -= 0.1
end
print("SWORD COOLDOWN HAS DECREASED BY : ", stabInterval)
elseif abilityName == "SwordAttackscale" then
local swords = getAllSwords() -- Get all sword models
for _, swordModel in pairs(swords) do
local scale = swordModel:GetScale() -- Ensure sword has a scaling method
local newScale = scale + (scale * 0.1)
swordModel:ScaleTo(newScale) -- Scale the sword accordingly
end
print("SWORD SCALING")
elseif abilityName == "SwordAttack" then
local swords = getAllSwords()
for _, swordModel in pairs(swords) do
DAMAGE += 4
print("SWORD ATTACK BOOST. DAMAGE: ", DAMAGE)
end
elseif abilityName == "SwordAttackAdd" then
local swords = getAllSwords() -- Add a new sword
local swordModel = swords[1] -- Ensure we use an existing sword
local CloneSwordModel = swordModel:Clone()
local offset = Vector3.new(3, 0, 0)
local newPosition = swordModel.PrimaryPart.Position + offset
CloneSwordModel:SetPrimaryPartCFrame(CFrame.new(newPosition))
CloneSwordModel.Parent = character
local motor = Instance.new("Motor6D")
motor.Name = "SwordMotor"
motor.Part0 = character:WaitForChild("RightHand")
motor.Part1 = CloneSwordModel.PrimaryPart
motor.C0 = CFrame.new(3, 0, 0)
motor.C1 = CFrame.new(0, 0, 0)
motor.Parent = character:WaitForChild("RightHand")
WeaponController.Visible(player, CloneSwordModel, true)
print(character:GetChildren())
end
end)
RunService.RenderStepped:Connect(UpdateSwordPosition)
Code #3
This makes sword attack sequentially one after another but the problem is the sword at the end is anchored at the same place
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Star = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("Star"))
local SelectCard = Remotes:WaitForChild("SelectCard")
local AttributeAbility = Remotes:WaitForChild("AttributeAbility")
local healthUpdateEvent = ReplicatedStorage:WaitForChild("HealthUpdateEvent")
local WeaponController = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("WeaponController"))
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
local DAMAGE = 1
local radius = 5
local forwardOffset = 3
local stabDistance = 5
local stabTime = 0.5
local speedStab = 2
local stabInterval = 3
local heightOffset = 2
local delayBetweenSwords = 0.3 -- délai entre les attaques de chaque épée
local debounceMonsters = {}
local isStabbing = false
local swordAnimations = {} -- stocker les mouvements de la première épée
local function SmoothCurve(t)
return 1 - math.pow(1 - t, 3)
end
local function FindPoint(mouseRay, planeY)
local direction = mouseRay.Direction
local origin = mouseRay.Origin
if direction.Y == 0 then return nil end
local distance = (planeY - origin.Y) / direction.Y
return origin + direction * distance
end
local function getAllSwords()
local swords = {}
for _, item in pairs(character:GetChildren()) do
if item.Name:match("^Warrior Sword") then
table.insert(swords, item)
end
end
table.sort(swords, function(a, b) return a.Name < b.Name end)
return swords
end
local function AnimatePrimarySword(sword, direction, root)
swordAnimations = {} -- reset animation data
local invisiblePart = sword:WaitForChild("invisible filling part")
for t = 0, stabTime, RunService.RenderStepped:Wait() do
local progress = math.clamp(t / stabTime, 0, 1)
local eased = SmoothCurve(progress)
local position = root + direction * (radius + forwardOffset + eased * stabDistance)
local cframe = CFrame.lookAt(position, position + direction) * CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
sword:SetPrimaryPartCFrame(cframe)
table.insert(swordAnimations, {position = position, cframe = cframe})
-- Apply damage
for _, part in ipairs(invisiblePart:GetTouchingParts()) do
if part.Name ~= "OtherGrip" and not debounceMonsters[part.Parent] then
debounceMonsters[part.Parent] = true
healthUpdateEvent:FireServer(DAMAGE, part.Parent)
task.delay(1, function()
debounceMonsters[part.Parent] = false
end)
end
end
end
end
local function AnimateCloneSword(sword, delay)
task.delay(delay, function()
for _, keyframe in ipairs(swordAnimations) do
sword:SetPrimaryPartCFrame(keyframe.cframe)
RunService.RenderStepped:Wait()
end
end)
end
local function DoStabAnimation()
if not player:FindFirstChild("IsPlaying") or not player.IsPlaying.Value then return end
local rootPart = character.PrimaryPart
local head = character:FindFirstChild("Head")
if not rootPart or not head then return end
local target = FindPoint(mouse.UnitRay, head.Position.Y)
if not target then return end
local direction = (Vector3.new(target.X, rootPart.Position.Y, target.Z) - rootPart.Position).Unit
local swords = getAllSwords()
if #swords == 0 then return end
isStabbing = true
local mainSword = swords[1]
AnimatePrimarySword(mainSword, direction, rootPart.Position)
for i = 2, #swords do
local delay = (i - 1) * delayBetweenSwords
AnimateCloneSword(swords[i], delay)
end
isStabbing = false
end
task.spawn(function()
while true do
task.wait(stabInterval)
local swords = getAllSwords()
for _, sword in pairs(swords) do
WeaponController.Visible(player, sword, true)
end
DoStabAnimation()
end
end)
AttributeAbility.Event:Connect(function(abilityName)
if abilityName == "SwordAttackSpeed" then
if speedStab > 0.1 then speedStab -= (speedStab * 0.1) end
elseif abilityName == "SwordAttackCooldown" then
if stabInterval > 0.1 then stabInterval -= 0.1 end
elseif abilityName == "SwordAttackscale" then
for _, sword in pairs(getAllSwords()) do
local scale = sword:GetScale()
sword:ScaleTo(scale + (scale * 0.1))
end
elseif abilityName == "SwordAttack" then
DAMAGE += 4
elseif abilityName == "SwordAttackAdd" then
local swords = getAllSwords()
local first = swords[1]
local clone = first:Clone()
clone:SetPrimaryPartCFrame(first.PrimaryPart.CFrame + Vector3.new(3, 0, 0))
clone.Parent = character
local motor = Instance.new("Motor6D")
motor.Name = "SwordMotor"
motor.Part0 = character:WaitForChild("RightHand")
motor.Part1 = clone.PrimaryPart
motor.C0 = CFrame.new(3, 0, 0)
motor.C1 = CFrame.new(0, 0, 0)
motor.Parent = character:WaitForChild("RightHand")
WeaponController.Visible(player, clone, true)
end
end)
Code #4
I tried to duplicate the localscript but it caused problem with overduplication with localscript I thought that my idea was good and could execute like 2x, 3x the sword
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Star = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("Star"))
local SelectCard = Remotes:WaitForChild("SelectCard")
local AttributeAbility = Remotes:WaitForChild("AttributeAbility")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()
-- Pour récupérer toutes les épées qui commencent par "Warrior Sword"
local function getAllSwords()
local swords = {}
for _, item in pairs(character:GetChildren()) do
if item.Name:match("^Warrior Sword") then
table.insert(swords, item)
end
end
return swords
end
local healthUpdateEvent = ReplicatedStorage:WaitForChild("HealthUpdateEvent")
local WeaponController = require(ReplicatedStorage:WaitForChild("ClientScripts"):WaitForChild("WeaponController"))
local DAMAGE = 1
local radius = 5
local forwardOffset = 3
local stabDistance = 5
local stabTime = 3
local stabCooldown = 0.5
local speedStab = 2
local stabInterval = 3
local heightOffset = 2
local elapsedTime = 0
local isStabbing = false
local isStabbingEnded = false
local currentPosition = nil
local stabFinalOffset = nil
local stabFinalDirection = nil
local disappearSword = false
local forceStop = false
local NumberSword = 0
local debounceMonsters = {}
local function SmoothCurve(t)
return 1 - math.pow(1 - t, 3)
end
local function FindPoint(mouseRay, planeY)
local direction = mouseRay.Direction
local origin = mouseRay.Origin
if direction.Y == 0 then return nil end
local distance = (planeY - origin.Y) / direction.Y
return origin + direction * distance
end
local function UpdateSwordPosition(deltaTime)
if not player:FindFirstChild("IsPlaying") or not player.IsPlaying.Value then return end
if not character or not character.PrimaryPart then return end
local root = character.PrimaryPart.Position
local head = character:FindFirstChild("Head")
if not head then return end
local targetPosition = FindPoint(mouse.UnitRay, head.Position.Y)
if not targetPosition then return end
local horizontalTarget = Vector3.new(targetPosition.X, root.Y, targetPosition.Z)
local direction = (horizontalTarget - root).unit
local swords = getAllSwords()
local swordCount = #swords
local angleStep = math.pi * 2 / swordCount
for index, swordModel in pairs(swords) do
local invisibleFillingPart = swordModel:WaitForChild("invisible filling part")
if not invisibleFillingPart then
warn("SHARP part is missing in the sword model!")
return
end
if isStabbing and not isStabbingEnded then
if elapsedTime == 0 then
stabFinalDirection = direction
end
disappearSword = false
elapsedTime += deltaTime * speedStab
local progress = math.clamp(elapsedTime / stabTime, 0, 0.4)
local easedProgress = SmoothCurve(progress)
if progress >= 0.4 then
stabFinalOffset = swordModel.PrimaryPart.Position - root
isStabbing = false
isStabbingEnded = true
elapsedTime = 0
end
local swordPosition = root + stabFinalDirection * (radius + forwardOffset + easedProgress * stabDistance) + Vector3.new(0, heightOffset, 0)
currentPosition = swordPosition
swordModel:SetPrimaryPartCFrame(
CFrame.lookAt(swordPosition, swordPosition + stabFinalDirection)
* CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
)
for _, part in ipairs(invisibleFillingPart:GetTouchingParts()) do
if part.Name ~= "OtherGrip" then
if not debounceMonsters[part.Parent] then
debounceMonsters[part.Parent] = true
healthUpdateEvent:FireServer(DAMAGE, part.Parent)
task.wait(1)
debounceMonsters[part.Parent] = false
end
end
end
elseif not isStabbing and isStabbingEnded then
if stabFinalOffset and stabFinalDirection then
elapsedTime += deltaTime * speedStab
local progress = math.clamp(0.4 + (elapsedTime / stabTime), 0, 1)
local easedProgress = SmoothCurve(progress)
if progress >= 0.4 and not disappearSword then
disappearSword = true
WeaponController.Visible(player, swordModel, false)
end
local swordPosition = root + stabFinalDirection * (radius + forwardOffset + easedProgress * stabDistance) + Vector3.new(0, heightOffset, 0)
currentPosition = swordPosition
swordModel:SetPrimaryPartCFrame(
CFrame.lookAt(swordPosition, swordPosition + stabFinalDirection)
* CFrame.Angles(math.rad(90), math.rad(90), math.rad(180))
)
end
end
end
end
task.spawn(function()
while true do
task.wait(stabInterval)
local swords = getAllSwords()
for _, swordModel in pairs(swords) do
WeaponController.Visible(player, swordModel, true)
end
isStabbing = true
isStabbingEnded = false
elapsedTime = 0
forceStop = false
end
end)
AttributeAbility.Event:Connect(function(abilityName)
if abilityName == "SwordAttackSpeed" then
if speedStab > 0.1 then
speedStab -= (speedStab * 0.1)
end
print("SWORD SPEED HAS INCREASED BY : ", speedStab)
elseif abilityName == "SwordAttackCooldown" then
if stabInterval > 0.1 then
stabInterval -= 0.1
end
print("SWORD COOLDOWN HAS DECREASED BY : ", stabInterval)
elseif abilityName == "SwordAttackscale" then
local swords = getAllSwords() -- Get all sword models
for _, swordModel in pairs(swords) do
local scale = swordModel:GetScale() -- Ensure sword has a scaling method
local newScale = scale + (scale * 0.1)
swordModel:ScaleTo(newScale) -- Scale the sword accordingly
end
print("SWORD SCALING")
elseif abilityName == "SwordAttack" then
local swords = getAllSwords()
for _, swordModel in pairs(swords) do
DAMAGE += 4
print("SWORD ATTACK BOOST. DAMAGE: ", DAMAGE)
end
elseif abilityName == "SwordAttackAdd" then
local ScriptClone = script:Clone()
ScriptClone.Name = ScriptClone.Name .. NumberSword
ScriptClone.Parent = character
end
end)
RunService.RenderStepped:Connect(UpdateSwordPosition)