there is 6 different enemies so id rather make it easier if possible name is 'Enemy1,Enemy2' ext
04:24:52.059 - Players.Player1.PlayerGui.Gui.Bars.Bars:8: attempt to concatenate global 'tostring' (a function value)
local hud = script.Parent.Parent local core = hud.Core local enemies = hud.FightArea.Enemies local team = hud.FightArea.Team local enemy = hud.Enemy local ally = hud.Ally enemy["Enemy"..tostring()].Stats.HP.Changed:connect(function() if enemy["Enemy"..tostring()].Stats.HP.Value <0 then enemy["Enemy"..tostring()].Stats.HP.Value = 0 hud.Dead.Enemy.Value = hud.Dead.Enemy.Value + 1 if hud.Dead.Enemy.Value == 6 then core.Gold.Value = core.Gold.Value + core.GoldDrop.Value enemy["Enemy"..tostring()].Stats.HP.Value = enemy["Enemy"..tostring()].Stats.MaxHP.Value core.kills.Value = core.kills.Value + 1 if core.Kills.Value >= 10 then hud.FightArea.nextstage.Visible = true end end end enemies["Enemy"..tostring()].HPBar.hptext.Text = enemy["Enemy"..tostring()].Stats.HP.Value.."/"..enemy["Enemy"..tostring()].Stats.MaxHP.Value hud.FightArea.Kills.Text = core.Kills.Value.."/".."10" enemies["Enemy"..tostring()].HPBar.Bar:TweenSize(UDim2.new(enemy["Enemy"..tostring()].Stats.HP.Value/enemy["Enemy"..tostring()].Stats.MaxHP.Value,0,1,0), "Out", "Quad", 0, false) end)
Look at what you're doing. Your tostring
is redundant, as it's simply taking nothing as an argument. Remove it and your script will stop erroring from it.