I want to make it appear (transparency 0) only if player near this barrier and other barriers is transparency 1
Can someone help me?
I want to make it appear (transparency 0) only if player near this barrier and other barriers is transparency 1
Hey there
You can use Magnitude to figure out the distance, in a loop such as RenderStepped or While true do.
Then if the Distance is smaller than the distance needed to turn the transparency on, you can tween the parts transparency.
However keep in mind that it’ll be getting the Distance from the middle of the part.
The combat this you can use an attachment, so you can set it whereever on the part, or even multiple of them (for example in left, right and middle)
I feel like getting distance in every frame is quite expensive in my opinion. I think HumanoidRootPart:GetPropertyChangedSignal(“Position”) is cheaper
Yep, there is. Check out magnitude.
For example, this code would print the amount of studs between 2 parts:
local magnitude = (workspace.Part1.Position - workspace.Part2.Position).Magnitude
print(magnitude)
You can take this code and modify it so that one part is the player’s torso, and one is the wall. Then, I would put it in a while loop, or RenderStepped loop and constantly update the magnitude, checking if the player is close enough to the wall.
Hopefully this was helpful!
i need to find distance between point of part, not center, to humanoid root part
