Highlight instance not working properly

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to make a custom healthbar for zombies in my game, and i tough of using the highlight instance with changing colors in order to achieve that.

  1. What is the issue? Include screenshots / videos if possible!

The thing is, whenever i changed the color of a zombie’s highlight for some reason even the other unaffected zombie’s color would change instead as shown below.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked around a bit but didn’t find anything, so i figured to look here.

This is the current code i use:


local zombie = script.Parent.Parent
local highlight = zombie.Highlight --i even set the adornee as the group for the zombie character.

humanoid.HealthChanged:Connect(function()

	local hppercent = humanoid.Health/humanoid.MaxHealth

	highlight.OutlineColor = Color3.fromHSV(hppercent * 0.3, 1, 1)
end)

I am guessing the issue might be because the highlight instance isn’t fully released or completed, please correct me if i’m wrong!

2 Likes

Try possibly getting the health > instead of getting the health Color.
This is possibly where you’re getting the error from.

Color3.fromHSV(hppercent)
You should try detecting it with.

if humanoid.Health/humanoid.MaxHealth == 100 then
ColorValue = "Color"
end
highlight.OutlineColor = Color3.fromHSV(ColorValue )
1 Like

I’m very confident that’s not the issue, when i try a single zombie the script works fine, the problem emerges when there’s more than one zombie, somehow the game thinks that their highlight areas are related while they’re actually not :slightly_frowning_face:

1 Like

Could you show the code that’s detecting which zombies are supposed to be affected?

Do the highlights always appear?
Also, seeing script.parent.parent I assume the script is inside of the zombie?
You could maybe run this on one script and have a folder for the zombies, the using i, v in pairs to highlight all the zombies in that folder

The issue isnt highlighting or not, its the fact that whenever the color of a highlight is changed it affects the color of a completely unrelated one.

1 Like

I dont have it on hand at this moment, but the script is inside a folder inside the zombie (therefore script.Parent.Parent is the zombie), and this script is inside every one of them. Therefore other zombies shouldnt be affected like this since i never get out of the zombie, as i said, this is most likely because the feature might have not been fully released.

Where are you defining that this is the affected zombies Humanoid? Isn’t it just checking to see if a random Humanoid in the game has changed?

Ah, my bad, i forgot to mention that the humanoid variable is the humanoid inside the zombie variable

How does the damage/impact script work? I tested the highlights with tons of models and had no issues

Yeah, thanks for the advice! altrough i decided to use another method to make a healthbar so this isnt a issue anymore :slight_smile:

Does this still replicate the highlight effect? Sometimes mine don’t even apply (outside of studio) so I’m looking for alternatives.

No, i instead used a entirely different method which is completely unrelated to highlights, sorry.

1 Like

Maybe I’m a little late but. I had the same issue, in my case the highlight of the dummies was already in the model. What I mean by this is that I had previously manually placed the highlight in the dummy, I for some reason decided to create a new highlight with Instance.new() and this error didn’t repeat.

So basilically, using pre-existing highlights didn’t work, but ones created with Instance.new() did?
If so then that kinda makes sense since when i stopped playing the highlights’ color changed without my control

Thought I was the one with the same problem, highlights are kinda weird if you use a pre-existing one. Sometimes they don’t change color, or they do when you don’t want to or even they don’t show at all.

1 Like

Woah it’s September already and the issue is still happening.
In my cases Highlight glitches with my building system.

i honestly hope it will start working soon, this feature seems to have a lot of potential!

1 Like

Highlights are a great feature with a lot of potential indeed. It’s a shame that they are still not fully functional as it seems.

This highlight is so bugged! I have a project with almost no parts and this highlight bug even the BASEPLATE hahaha

The adornee is setted to the ARROW! LOL!