So, I've made a script that checks an AI's health, and if the AI's health is below 700, it's supposed to switch his swords
I've ran the code in the command bar and it worked fine, but whenever I add it into a script, it doesn't execute the if statement (or at least that's what I'm guessing, because once I damage the AI past 700, it doesn't switch swords
It's in a script located inside Workspace
if game.Workspace.AI.Sword.Humanoid.Health <= 700 then game.Workspace.AI.Sword.FireSword:Remove() game.Lighting.SecondSword:Clone().Parent = game.Workspace.AI.Sword end
Add a while wait() do.
while wait() do if game.Workspace.AI.Sword.Humanoid.Health <= 700 then game.Workspace.AI.Sword.FireSword:Remove() game.Lighting.SecondSword:Clone().Parent = game.Workspace.AI.Sword end end
if this worked your welcome :) ~KIheros