Hello, I need help creating a red character highlight.
Basically, when the player gets damaged, the player’s whole character should flash red, something like Bedwars (see example below). I know how to script it, but I have no idea how to actually make the effect.
It isn’t that hard. All you need is the scripting skills and most importantly the idea. As you know how to script it, here’s an idea:
- First, make a loop where you go through all the objects inside the character. And make sure to store the object’s color in a variable before you change the color.
- Second, make check if the object is a Part or an Accessory. If it is, then turn it’s color to red (RGB Value - (255, 255, 255)).
- Third, wait for an amount of time you want. (Recommended 0.1 to 0.25 seconds.)
- Fourth, just change the object’s color to the color you stored in the variable.
Yes I already tried that before:
- I don’t think creating an ObjectValue for every character part is a good idea.
- Not sure what you mean by accessory, as most accessories use meshes. I guess I could make it a bright red texture - but then how do I make it so that it’s actually a red highlight, like if it’s originally yellow then it should have a red-yellow color (see image).
Honestly i would use his method ateast for a few months until toblox releases the highlight instance
Yes it was released but removed quickly after.
But then how does Bedwars do it?
Instead of creating object values for each part, you can use attributes to store the original color of the part
-- Setting an attribute with Instance:SetAttribute()
part:SetAttribute("previousColor",part.Color)
-- Getting the old color value is then as simple as:
local oldColor = part:GetAttribute("previousColor")
for i,v in pairs(character:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("Mesh") do
local oldColor = v.Color
v.Color = Color3.new(your color here)
wait(0.3)
v.Color = oldColor
end
end
Something like this should work.
You can toss a copy of the character into a viewport frame and render it on a gui. As long as you continue to update the character and camera CFrame on renderstep, you should have a GUI of just the character overlayed on the actual game render. From there you can manipulate the way that the viewport renders to adjust the color.
This method may be a lot more work but probably gets you as close as you can get to the effect that you are looking for.
@oli646464 I think you misread the post, I’m asking how to create the effect, not how to store attributes which I already know how to.
@MrSlimer123 Thanks but please read the reply above.
@VitalWinter Interesting solution. I’ll try it later.
Thanks but please read the reply above.
Interesting solution. I’ll try it later.
Im sorry, I only meant to supply a solution to a problem you had mentioned.
As @VitalWinter mentioned, a viewport gui is a viable solution but is going to require some work. Optimisation might be a problem too, but if you have any further questions, please ask them.
That’s the exact same thing I explained in my post. Thanks for converting to a code!
Anyways, other than my solution I like @VitalWinter’s idea too for using ViewportFrames. But again as @oli646464 said, it is going to have some work but I do believe you can so it.