Set the color of the descendants’ particles or anything that has a color property
and why are u pcalling??? pcalling is for networking, you have no reason to pcall here, you are just avoiding errors that might be your issue
As you can see it’s the first thing that gets executed so no it’s not the pcall’s fault. I’m pcalling for code readability, it outweights the extra performance cost imo
It sounds like you don’t know what pcall even is.
Just cause Color assignment is executed first inside a pcall doesn’t mean it can’t be it’s fault.
I’m pcalling for code readability
That’s one of the foolish things I’ve ever heard someone say.
Remove the goddamn pcall
Pcall is a protected call, code inside it doesn’t throw an error if it does and stops execution inside the pcall. That’s what it does. The first line which is the set color line will always execute for all descendants (will throw an error if they dont have a color property which is already expected). Explain how it’s foolish to use pcall for readability in that situation instead of using a ton of IsA making the code at least twice as long?
Printing any color3 value always returns a percentage value from 0 to 1.
If you want to print it in RGB format then multiply the individual components by 255 and round them.
Yeah it’s not a bug just something off with this specific situation which I mentioned
pcall is meant for error handling and not controlling program flow in a predictable manner
pcall hides the real problem by suppressing the errors, which means if error occurs (such as trying to set a property) it fails silently, doesn’t matter if its the first instruction of the pcall’s body. if it fails. it fails.
pcall is designed for situations where an unpredictable runtime error might occur (eg. HTTP requests, external calls. Using it to avoid explicit type checking is an abuse of its intended purpose.
and your “performance” issue, pcall is less performant than an IsA cause of it’s error handling mechanism.
but sure, if all you’ve learned in your whole life is bad practice, then go ahead, whine about your problem and use everything how its not intended to be used
I know what’s a pcall my guy, I’m using it in this case because it works best for me not because I think it’s generally good practice. “Whine about your problem” LOL, yeah you know it’d help if you actually said something relevant to the problem if you’re going to comment about it
I know what’s a pcall my guy
clearly you don’t, if you knew you would use it for it’s intended purpose
That’s not very nice. Sure, the pcall
is bad practice in this case, but you don’t need to be so demeaning.
Just giving my 2c and agreeing it is bad practice in this case, because you aren’t even checking whether it succeeds, you are just hiding any runtime errors that occur and adding unnecessary noise to your code.
There would literally be no difference in the behavior of you code if you removed the pcall
statement, it would just be shorted and easier to read.
That’s because a Color3
is not a ColorSequence
(obviously).
Here is what you can do:
local cs = ColorSequence.new({
ColorSequenceKeypoint.new(0,Color3.new(0,0,1)),
ColorSequenceKeypoint.new(1,Color3.new(1,0,0)),
})
local col = Color3.new(cs.Keypoints[1].Value.R,cs.Keypoints[1].Value.G,cs.Keypoints[1].Value.B)
print(col)
yeah you know it’d help if you actually said something relevant to the problem if you’re going to comment about it
before fixing your main issue, start by fixing your smaller problems first
next.
I’m not expecting it to succeed, just set descendants’ properties which is why I put things in a specific order for it to work out exactly how I planned
The pcall
has no effect on the order of execution. You could effectively remove the pcall
keyword and it would function exactly the same.
Color3Value inside ColorSequence.new should work though no? It’d just make all the keypoints the same color no?
It’s usually a good practice to focus on the main issues as they are the ones that will determine the end result. Small issues are usually silent and don’t modify the end result by a ton.
I didnt say it has any effect, I said I put things there in order so if it fails it’d first set all the properties I wanted it to
i just said focusing on main issues requires you to fix any smaller problems that might be the cause / root of your main problem
Yes it should and it would.
I recommend sending in the script here, not the image but copy paste it here.
I would also recommend encapsulating it in three back quotes ( ` ).
So according to this terminology the usage of pcall
is termed as the root of OPs issue?