Hello! So I’m trying to make a Boss Battle, I made a Explosion for when the boss Punches, The issue is that whenever I try to set the Position for the Explosion it always errors, here’s the error and the script.
09:50:26.032 Workspace.Dummy.AttackHandler:36: invalid argument #3 (Instance expected, got Vector3) - Server - AttackHandler:36
local Boss = script.Parent
local character = script.Parent
local humanoid = character:FindFirstChild("Humanoid")
local AttackList = {"Punch", "Stomp", "Drill"}
local ChosenAttack = nil
local IdleAnim = script.Idle
local PunchAnim = script.Punch
local StompAnim = script.Stomp
local DrillAnim = script.Drill
local DeathAnim = script.Death
local animationTrack = humanoid:LoadAnimation(IdleAnim)
animationTrack:Play()
while true do
wait(5)
ChosenAttack = AttackList[math.random(1, #AttackList)]
if ChosenAttack == "Punch" then
humanoid:LoadAnimation(PunchAnim):Play()
wait(1)
local exp = Instance.new("Explosion")
exp.Name = "Explosion"
exp.Parent = Boss["Right Arm"].Position
exp.Position = Boss["Right Arm"].Position
wait(1)
exp:Destroy()
end
if ChosenAttack == "Stomp" then
humanoid:LoadAnimation(StompAnim):Play()
wait(1.12)
local exp = Instance.new("Explosion")
exp.Name = "Explosion"
exp.Parent = Boss["Right Leg"].Position
exp.Position = Boss["Right Leg"].Position
wait(1)
exp:Destroy()
end
if ChosenAttack == "Drill" then
humanoid:LoadAnimation(DrillAnim):Play()
wait(3.2)
local exp = Instance.new("Explosion")
exp.Name = "Explosion"
exp.Parent = Boss["Right Arm"].Position
exp.Position = Boss["Right Arm"].Position
wait(1)
exp:Destroy()
end
if Boss.Humanoid.Health == 0 then
humanoid:LoadAnimation(DeathAnim):Play()
break
end
end