You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
Im trying to correct a system for my turn based game but the problem is that if multiple people are in a battle at the same time they target the slime at the same time leading it to breaking the game -
What is the issue? Include screenshots / videos if possible!
robloxapp-20240302-2057404.wmv (786.7 KB) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried setting the Enemies Parent to the player but It really just caused more issues
local part = game.Workspace.CombatTest
local TweenService = game:GetService("TweenService")
local TweeninfoLoading = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local TweeninfoStat = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Rep = game:GetService("ReplicatedStorage")
local StrikeEvent = Rep:WaitForChild("Combat").Strike
local CombatEvent = Rep:WaitForChild("Combat").Combat
local EnemyEvent = Rep:WaitForChild("Combat").Enemy
local EnemyClientEvent = Rep:WaitForChild("Combat").EnemyClient
local EndCombatEvent = Rep:WaitForChild("Combat").EndCombat
local CleaveEvent = Rep:WaitForChild("Combat").Cleave
local FireBallEvent = Rep:WaitForChild("Combat").FireBall
local IcePunchEvent = Rep:WaitForChild("Combat").IcePunch
local PillarEvent = Rep:WaitForChild("Combat").Pillar
local GustEvent = Rep:WaitForChild("Combat").Gust
local WaterJetEvent = Rep:WaitForChild("Combat").WaterJet
local ThunderBoltEvent = Rep:WaitForChild("Combat").ThunderBolt
local StormBreakerEvent = Rep:WaitForChild("Combat").StormBreaker
local SlimeBashEvent = Rep:WaitForChild("Combat").SlimeMelee
local SlimeSpitEvent = Rep:WaitForChild("Combat").SlimeRanged
local SlimeRestEvent = Rep:WaitForChild("Combat").SlimeRest
local spawns = false
local debounce = false
local InCombat = true
local BaseStrike = 5
local BaseCleave = 8
local BaseFireBall = 6
local BaseIcePunch = 5
local SlimeMelee = 10
local SlimeSpit = 15
local BasePillar = 3
local ServerScriptService = game:GetService("ServerScriptService")
local ItemService = require(ServerScriptService.ItemService)
local DropItems = false
local EXGAINSLIME = math.random(40, 75)
local lootTableA = ItemService.LootTables.LootTableA
local Enemies = {
Slime = "Slime",
BlueSlime = "BlueSlime"
}
CombatEvent.OnServerEvent:Connect(function(plr)
local Turns = plr:GetAttribute("Turn")
local char = plr.Character
plr:SetAttribute("InCombat", true)
plr:SetAttribute("Turn", 1)
plr:SetAttribute("YourTurn", true)
local EnemySpawn = Instance.new("Part")
EnemySpawn.Parent = workspace
EnemySpawn.Transparency = 1
EnemySpawn.Anchored = true
EnemySpawn.CanTouch = false
EnemySpawn.CanCollide = false
local PlrSpawn = Instance.new("Part")
PlrSpawn.Parent = workspace
PlrSpawn.Transparency = 1
PlrSpawn.Anchored = true
PlrSpawn.CanTouch = false
PlrSpawn.CanCollide = false
local PlrHealth = plr:GetAttribute("Health")
local MP = plr:GetAttribute("MP")
for enemyName, EnemyType in pairs(Enemies) do
local Enemy = Rep:WaitForChild("Enemies"):FindFirstChild(EnemyType)
if Enemy then
local clonedEnemy = Enemy:Clone()
clonedEnemy.Parent = workspace
local function plrlook()
local lookAtCFrame = CFrame.lookAt(plr.Character.PrimaryPart.Position, EnemySpawn.Position)
plr.Character:SetPrimaryPartCFrame(lookAtCFrame)
end
PlrSpawn.CFrame = char:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, -3, -20)
EnemySpawn.CFrame = char:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, -3, 20)
local Slime = clonedEnemy
Slime.CFrame = EnemySpawn.CFrame * CFrame.new(0, 2, 0)
local HealthPart = Instance.new("Part")
HealthPart.Parent = Slime
HealthPart.Anchored = true
HealthPart.CanCollide = false
HealthPart.CanTouch = false
HealthPart.Transparency = 1
HealthPart.CFrame = Slime.CFrame * CFrame.new(0, 4, 0)
local HealthBill = Instance.new("BillboardGui")
HealthBill.Parent = HealthPart
HealthBill.Size = UDim2.new(0, 300, 0, 50)
HealthBill.StudsOffset = Vector3.new(0, 2, 0)
HealthBill.MaxDistance = 100
local HealthFrame = Instance.new("Frame")
HealthFrame.Parent = HealthBill
HealthFrame.Size = UDim2.new(0, 300, 0, 50)
HealthFrame.BackgroundColor3 = Color3.fromRGB(77, 255, 0)
local HealthText = Instance.new("TextLabel")
HealthText.BackgroundTransparency = 1
HealthText.TextSize = 40
HealthText.Font = Enum.Font.Oswald
HealthText.Size = UDim2.new(0, 300, 0, 50)
HealthText.Parent = HealthBill
HealthText.Text = ""
HealthText.TextColor3 = Color3.fromRGB(255, 255, 255)
local EndCombatFlag = false
local function EndCombat()
if not EndCombatFlag and Slime:GetAttribute("Health") <= 0 then
EndCombatFlag = true
DropItems = true
Slime:Destroy()
char.Humanoid.AutoRotate = true
char.Humanoid.WalkSpeed = 16
char.Humanoid.JumpHeight = 7.2
PlrSpawn:Destroy()
EnemySpawn:Destroy()
plr:SetAttribute("EXP", plr:GetAttribute("EXP") + EXGAINSLIME)
EndCombatEvent:FireClient(plr)
wait(25)
plr:SetAttribute("InCombat", false)
-- Add the line below to stop the EndCombatEvent
EndCombatFlag = false
end
end
local function Freeze()
local Icepunch = math.random(1, 5)
if Icepunch == 3 then
Slime:SetAttribute("Frozen", true)
end
end
local ShieldPart = Rep:WaitForChild("Projectile/Objects").Shield:Clone()
ShieldPart.Parent = plr.Character:WaitForChild("HumanoidRootPart")
local function ShieldPartPos()
if plr:GetAttribute("HasShield") == true then
ShieldPart.CFrame = plr.Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, .5, 0)
print("Shield Applied")
else
return nil
end
end
ShieldPartPos()
local CheckHealth = coroutine.create(function()
while true do
local maxHealth = Slime:GetAttribute("MaxHealth")
local currentHealth = Slime:GetAttribute("Health") or maxHealth
local maxsize = 300
local healthRatio = currentHealth / maxHealth
local newhealthsize = math.min(maxsize, maxsize * healthRatio)
HealthText.Text = tostring(currentHealth).. "/".. tostring(maxHealth)
if currentHealth > maxHealth then
currentHealth = maxHealth
healthRatio = 1
newhealthsize = maxsize
end
TweenService:Create(HealthFrame, TweenInfo.new(1), {Size = UDim2.new(0, newhealthsize, 0, 50)}):Play()
wait(1)
EndCombat()
print("Enemy Health Updated")
end
end)
local function SlimeMelee()
if Slime:GetAttribute("Frozen") then
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
EnemyClientEvent:FireClient(plr)
Slime:SetAttribute("Frozen", false)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
else
SlimeBashEvent:FireClient(plr)
wait(1)
Slime.CFrame = PlrSpawn.CFrame * CFrame.new(0, 2, 5)
TweenService:Create(Slime, TweenInfo.new(1), {CFrame = PlrSpawn.CFrame * CFrame.new(0, 2, -5)}):Play()
wait(1.5)
Slime.CFrame = EnemySpawn.CFrame * CFrame.new(0, 2, 0)
if plr:GetAttribute("HasShield") then
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
plr:SetAttribute("Health", plr:GetAttribute("Health") - 5)
ShieldPart:Destroy()
plr:SetAttribute("HasShield", false)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
else
plr:SetAttribute("Health", plr:GetAttribute("Health") - 10)
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
end
end
end
local function SlimeRanged()
if Slime:GetAttribute("Frozen") then
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
EnemyClientEvent:FireClient(plr)
Slime:SetAttribute("Frozen", false)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
else
SlimeSpitEvent:FireClient(plr)
local Projectile = Instance.new("Part")
Projectile.Parent = Slime
Projectile.Shape = Enum.PartType.Ball
Projectile.Material = Enum.Material.Neon
Projectile.Color = Color3.fromRGB(0, 255, 0)
Projectile.CanCollide = false
Projectile.Anchored = true
Projectile.CFrame = Slime.CFrame
local tween = TweenService:Create(Projectile, TweenInfo.new(1), {CFrame = PlrSpawn.CFrame * CFrame.new(0, 1.5, 0)})
tween:Play()
tween.Completed:Wait() -- Wait for the tween to complete before continuing
wait(0.5)
if plr:GetAttribute("HasShield") then
Projectile:Destroy()
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
plr:SetAttribute("Health", plr:GetAttribute("Health") - 7.5)
ShieldPart:Destroy()
plr:SetAttribute("HasShield", false)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
else
Projectile:Destroy()
plr:SetAttribute("Health", plr:GetAttribute("Health") - 15)
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
end
end
end
char:MoveTo(PlrSpawn.Position)
char.Humanoid.AutoRotate = false
plrlook()
-- Strike Script
StrikeEvent.OnServerEvent:Connect(function(plr)
local BaseStikeBreaker = 6
local AtkScaling = plr:GetAttribute("Atk") * 0.15
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local InitalDamage = BaseStikeBreaker + AtkScaling + ElementalScaling
if not debounce and plr:GetAttribute("StormBreakerDur") > 0 then
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16361874020"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
ShieldPartPos()
wait(.7)
local StormStrike = Rep:WaitForChild("Projectile/Objects").StormStrike:Clone()
StormStrike.Parent = char:WaitForChild("HumanoidRootPart")
StormStrike.CFrame = Slime.CFrame * CFrame.new(0, 5, 0)
ShieldPartPos()
plrlook()
print(InitalDamage)
AnimationTrack:Stop()
plr:SetAttribute("YourTurn", false)
wait(2)
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - InitalDamage)
StormStrike:Destroy()
debounce = false
else
debounce = true
local StrikeDamage = BaseStrike + AtkScaling
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16446206797"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
char:MoveTo(Slime.Position + Slime.CFrame.LookVector * 5)
ShieldPartPos()
wait(1.6)
char:WaitForChild("HumanoidRootPart").CFrame = PlrSpawn.CFrame
ShieldPartPos()
plrlook()
print(StrikeDamage)
print(plr:GetAttribute("Atk"))
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - StrikeDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 5)
plr:SetAttribute("YourTurn", false)
wait(.2)
debounce = false
end
end)
--CleaveScript
CleaveEvent.OnServerEvent:Connect(function(plr)
ShieldPartPos()
local AtkScaling = plr:GetAttribute("Atk") * 0.15
local CleaveDamage = BaseCleave + AtkScaling
if not debounce then
debounce = true
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16433195744"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
char:MoveTo(Slime.Position + Slime.CFrame.LookVector * 5)
ShieldPartPos()
wait(1.5)
char:WaitForChild("HumanoidRootPart").CFrame = PlrSpawn.CFrame
ShieldPartPos()
plrlook()
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - CleaveDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 5)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 1)
plr:SetAttribute("YourTurn", false)
wait(.2)
plrlook()
debounce = false
end
end)
--Fire Section
FireBallEvent.OnServerEvent:Connect(function(plr)
plrlook()
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local FireBallDamage = BaseFireBall + ElementalScaling
if not debounce then
local fireball = Rep:WaitForChild("Projectile/Objects"):FindFirstChild("Fireball"):Clone()
fireball.Parent = workspace -- Place fireball in workspace
fireball.CFrame = char["Left Arm"].CFrame * CFrame.new(1, -2.5, 0)
fireball.CanCollide = false
fireball.CanTouch = false
local weld = Instance.new("WeldConstraint", fireball)
weld.Part0 = fireball
weld.Part1 = char["Left Arm"]
debounce = true
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://15475611679"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
wait(1)
weld:Destroy()
fireball.Anchored = true
plrlook()
AnimationTrack:Stop()
TweenService:Create(fireball, TweenInfo.new(1), {CFrame = Slime.CFrame * CFrame.new(0, 1.5, 0)}):Play()
game.Debris:AddItem(fireball, 1)
print(FireBallDamage)
print(plr:GetAttribute("ElementalMastery"))
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - FireBallDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 8)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 1)
plr:SetAttribute("YourTurn", false)
wait(.2)
debounce = false
end
end)
--Ice Section
IcePunchEvent.OnServerEvent:Connect(function(plr)
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local IcePunchDamage = BaseIcePunch + ElementalScaling
if not debounce then
debounce = true
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16433634782"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
char:MoveTo(Slime.Position + Slime.CFrame.LookVector * 5)
ShieldPartPos()
wait(1.6)
char:WaitForChild("HumanoidRootPart").CFrame = PlrSpawn.CFrame
ShieldPartPos()
plrlook()
print(IcePunchDamage)
print(plr:GetAttribute("ElementalMastery"))
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - IcePunchDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 5)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 1)
plr:SetAttribute("YourTurn", false)
Freeze()
wait(.2)
debounce = false
end
end)
-- Earth Section
PillarEvent.OnServerEvent:Connect(function(plr)
ShieldPartPos()
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local PillarDamage = BasePillar + ElementalScaling
if not debounce then
debounce = true
ShieldPartPos()
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16433634782"
Anim.Parent = char
local Pillar = Rep:WaitForChild("Projectile/Objects").Pillar:Clone()
Pillar.Parent = workspace
Pillar.CFrame = Slime.CFrame * CFrame.new(0, -5, -22)
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
TweenService:Create(Pillar, TweenInfo.new(2), {CFrame = Slime.CFrame * CFrame.new(0, 4, -22)}):Play()
ShieldPartPos()
wait(1.6)
ShieldPartPos()
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 6)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 2)
TweenService:Create(ShieldPart, TweeninfoLoading, {Transparency = 0.8}):Play()
ShieldPartPos()
ShieldPartPos()
plrlook()
print(PillarDamage)
print(plr:GetAttribute("ElementalMastery"))
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - PillarDamage)
plr:SetAttribute("HasShield", true)
wait(.2)
Pillar:Destroy()
debounce = false
ShieldPartPos()
end
end)
--Wind Section
GustEvent.OnServerEvent:Connect(function(plr)
ShieldPartPos()
local ElementalMastery = plr:GetAttribute("ElementalMastery") * 0.20
local GustDamage = BaseStrike + ElementalMastery
if not debounce then
debounce = true
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16553023053"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play()
print("Animation Playing")
local VFX = Rep:WaitForChild("Projectile/Objects").WindGustVFX:Clone()
VFX.Parent = workspace
local offset = Vector3.new(0, 4, 0) -- Adjust this offset as needed
local lookAtPosition = char.HumanoidRootPart.Position + char.HumanoidRootPart.CFrame.lookVector
VFX.CFrame = Slime.CFrame * CFrame.new(0, 0, 0) * CFrame.Angles(0, math.rad(90), 0)
print("Using Gust")
ShieldPartPos()
wait(1)
ShieldPartPos()
plrlook()
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - GustDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 7)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 1)
plr:SetAttribute("YourTurn", false)
wait()
plrlook()
VFX:Destroy()
debounce = false
end
end)
--Water Section
WaterJetEvent.OnServerEvent:Connect(function(plr)
plrlook()
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local WaterJetDamage = BaseStrike + ElementalScaling
if not debounce then
local Projectile = Instance.new("Part")
Projectile.Parent = Slime
Projectile.Shape = Enum.PartType.Ball
Projectile.Material = Enum.Material.Neon
Projectile.Color = Color3.fromRGB(49, 78, 223)
Projectile.CanCollide = false
Projectile.CFrame = char["Left Arm"].CFrame
local weld = Instance.new("WeldConstraint", Projectile)
weld.Part0 = Projectile
weld.Part1 = char["Left Arm"]
debounce = true
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16562718711"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play()
print("Animation Playing")
weld:Destroy()
plrlook()
Projectile.Anchored = true
TweenService:Create(Projectile, TweenInfo.new(1), {CFrame = Slime.CFrame * CFrame.new(0, 1.5, 0)}):Play()
game.Debris:AddItem(Projectile, 1)
print(WaterJetDamage)
print(plr:GetAttribute("ElementalMastery"))
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - WaterJetDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 5)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 1)
plr:SetAttribute("YourTurn", false)
wait(1.5)
debounce = false
AnimationTrack:Stop()
end
end)
--Thunder Section
ThunderBoltEvent.OnServerEvent:Connect(function(plr)
plrlook()
local ThunderBolt = 6
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local WaterJetDamage = ThunderBolt + ElementalScaling
if not debounce then
local ThunderParticle = Rep:WaitForChild("Projectile/Objects").ThunderPat:Clone()
ThunderParticle.Parent = char["Left Arm"]
ThunderParticle.CFrame = char["Left Arm"].CFrame * CFrame.new(0, -1.75, 0) * CFrame.Angles(0, math.rad(-180), math.rad(-90))
local weld = Instance.new("WeldConstraint", ThunderParticle)
weld.Part0 = ThunderParticle
weld.Part1 = char["Left Arm"]
debounce = true
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16568343003"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play()
print("Animation Playing")
wait(1)
local ThunderBolt = Rep:WaitForChild("Projectile/Objects").ThunderBolt:Clone()
ThunderBolt.Parent = workspace
ThunderBolt.CFrame = Slime.CFrame * CFrame.new(0, 17.5, 0) * CFrame.Angles(0, 0, math.rad(90))
local ThunderSlime = Rep:WaitForChild("Projectile/Objects").ThunderPat:Clone()
ThunderSlime.Parent = workspace
ThunderSlime.Anchored = true
ThunderSlime.CFrame = Slime.CFrame * CFrame.new(0, -1, 0) * CFrame.Angles(0, math.rad(-180), math.rad(-90))
weld:Destroy()
AnimationTrack:Stop()
ThunderParticle:Destroy()
plrlook()
AnimationTrack:Stop()
print(WaterJetDamage)
print(plr:GetAttribute("ElementalMastery"))
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - WaterJetDamage)
plr:SetAttribute("UltCharge", plr:GetAttribute("UltCharge") + 7)
plr:SetAttribute("MP", plr:GetAttribute("MP") - 1)
plr:SetAttribute("YourTurn", false)
wait(.6)
ThunderBolt:Destroy()
ThunderSlime:Destroy()
debounce = false
end
end)
StormBreakerEvent.OnServerEvent:Connect(function(plr)
local BaseInitalHit = 20
local AtkScaling = plr:GetAttribute("Atk") * 0.20
local DamageBuff = plr:GetAttribute("Atk") * 0.15
local ElementalScaling = plr:GetAttribute("ElementalMastery") * 0.20
local StormSword = true
if StormSword == true then
plr:SetAttribute("Atk", plr:GetAttribute("Atk") + DamageBuff)
end
local InitalDamage = BaseInitalHit + AtkScaling + ElementalScaling
if not debounce then
debounce = true
print("StormBreaker Press")
local Animator = char:WaitForChild("Humanoid").Animator
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://16571709629"
Anim.Parent = char
local AnimationTrack = Animator:LoadAnimation(Anim)
AnimationTrack:Play(wait(.5))
print("Animation Playing")
wait(.6)
local StormBreakerSword = Rep:WaitForChild("Projectile/Objects").StormBreaker:Clone()
StormBreakerSword.Parent = char["Left Arm"]
StormBreakerSword.CFrame = char["Left Arm"].CFrame * CFrame.new(0, -1.5, -1.2) * CFrame.Angles(-90, 90, 0)
local weld = Instance.new("WeldConstraint", StormBreakerSword)
weld.Part0 = StormBreakerSword
weld.Part1 = char["Left Arm"]
wait(1.3)
AnimationTrack:Stop()
ShieldPartPos()
print("StormBreaker Casted")
wait(.5)
local Anim1 = Instance.new("Animation")
Anim1.AnimationId = "rbxassetid://16433195744"
Anim1.Parent = char
local AnimationTrack2 = Animator:LoadAnimation(Anim1)
AnimationTrack2:Play()
print("Animation Playing")
ShieldPartPos()
plrlook()
print(InitalDamage)
print(plr:GetAttribute("Atk"))
wait(2)
Slime:SetAttribute("Health", Slime:GetAttribute("Health") - InitalDamage)
plr:SetAttribute("UltCharge", 0)
print("TUrn Over")
plr:SetAttribute("YourTurn", false)
plr:SetAttribute("StormBreakerDur", 6)
wait(.2)
debounce = false
end
end)
EnemyEvent.OnServerEvent:Connect(function()
local attack = math.random(1, 4)
if attack == 1 then
SlimeMelee()
elseif attack == 2 then
SlimeRanged()
elseif attack == 3 then
SlimeMelee()
elseif attack == 4 then
SlimeRestEvent:FireClient(plr)
plr:SetAttribute("MP", plr:GetAttribute("MP") + 1)
plr:SetAttribute("YourTurn", true)
plr:SetAttribute("Turn", plr:GetAttribute("Turn") + 1)
end
end)
coroutine.resume(CheckHealth)
end
end
end)
Ill send the local script if needed
im also kinda new so If this is simple im sorry