You can write your topic however you want, but you need to answer these questions:
I am working on a creation game, but I need to make barriers that become less transparent when you get closer to them
Here is an illustration describing what I am looking for:
I looked far and wide through the devforum, I have not found anything like this, but I am aware there is something a lot of math behind calculating the distance between two points.
anyways just find the magnitude of the player’s HumanoidRootPart and the Transparency changing part, then you can change transparency based off the magnitude
You only really need three things: DistanceFromCharacter, Transparency (or LocalTransparencyModifier if preserving the transparency is important - this would be a better option for your system) and Heartbeat. I prefer DistanceFromCharacter over magnitude because if the structure of the character ever changes, you never need to change your own code, it’ll get updated on the backend.
Heartbeat is what you use to run code every frame. DistanceFromCharacter is self explanatory as is transparency. Put those three together and you can work out a system for this.
All character models require a humanoidrootpart > So it wouldn’t matter if the character changes because it’ll still need a humanoidrootpart. Roblox’s system doesnt let rigs operate without one.
Believe it or not, HumanoidRootPart didn’t always exist. Suppose DistanceFromCharacter existed before HumanoidRootPart did and root parts became standard for working with character positions (before in 2010, we were conditioned to use Torso or Head). Now you have a lot of code to change.
DistanceFromCharacter would update on the backend to change from, say, checking the position from the Head to the HumanoidRootPart (which, AFAIK, is exactly what happened). Anyone using DistanceFromCharacter to check the position between a character and a vector point wouldn’t have to change any code, it would automatically account according to the HumanoidRootPart.
I use DistanceFromCharacter to future-proof my code.
I know it used to never exist, believe me I’m well aware. I was scripting during that time. HumanoidRootPart will never be removed so there’s really no reason to not use it > roblox literally said its making its system compatible with all old roblox rigs > meaning no matter how advanced the site gets r6 will still be around and so will humanoidrootpart c:
That’s fine. I use it to future-proof my code in case the structure ever changes. I don’t trust Roblox with any sorts of guarantees and there may be more idiomatic practices in the future to which DistanceFromCharacter will receive updates without me having to change it manually.
HumanoidRootPart is just as safe to use for magnitude checks, but I sure love my function. Bonus points for the way it looks in my code: nice, readable and explicit. Just one vector point and all the calculations are done for me by the engine.
I think it’s fine to discuss on the thread. It is slightly off topic but really there’s no need to break down my stance this hard. Support threads are good for offering and discussing advice, so as long as it stays constructive and on topic it’s fine. If it’s really that bad, you can flag it instead I guess - this should be done over calling it out on the thread because then that post too is off topic.
@Ryuunske I have faith they won’t deprecate it, don’t worry. Deprecation only happens for things that can’t and shouldn’t be supported anymore. No reason why this would reach that stage.
I wasn’t trying to make it sound harsh sorry
still pretty new to this forum and the word “off-topic” is just all over the place because it’s so strict sometimes, I just need to get used to the forum a bit more