What I'm asking is if you have a part and lets say a player walks near it, the half of the part is invisible (the closest part) and the other half is visible (furthest part). Please tell me if it is possible
Is it possible to make some of a part visible and the rest invisible?
2 answers
Did some research for about an hour and I created a script that detects if there is a part in front of you in a folder named "part" to become invisible when the magnitude is over 10. And if you want to changes the can collide just remove the -- in the line Here the code:
for i,v in pairs(game.Workspace.part:GetChildren()) do
local part = game.Workspace.part:GetChildren()
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
while wait() do
local HRP = character:WaitForChild("HumanoidRootPart")
if (HRP.Position - v.Position).Magnitude <= 10 then -- change mag if wanted
v.Transparency = 1
--v.CanCollide = false
else
v.Transparency = 0
--v.CanCollide = true
end
end
end)
end)
end
Here is a video of it: https://streamable.com/eqw3gc
3 comments
would this lag the game
because I did this in my script but I move the model under the player. I worked but lagged the game a lot
because I did this in my script but I move the model under the player. I worked but lagged the game a lot
You could take two parts that form one when put together (group + weld them together, if you want them to not be anchored) and script something that would recognize where the player is in relation to the model. That script could tell the furthest part of the model to turn its Transparency to 1. Something like, model.Transparency = 1
I wouldn't know how to write a whole code for this myself, but that's how I'd go about it, coming from a more builder background than a scripter one. You could work the code posted above by Jo1nts to function with two parts as opposed to one.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
As in a single part? I mean yeah, I can think of 3 different things: 1) Unions and negates through a script using magnitude (performance might be affected) 2) the glass and forcefield glitch 3) UI's