Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is it possible to make some of a part visible and the rest invisible?

Asked by 3 years ago

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

0
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 greatneil80 2647 — 3y

2 answers

Log in to vote
1
Answered by
Jo1nts 134
3 years ago
Edited 3 years ago

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

0
would this lag the game GameStealerKid 79 — 3y
0
because I did this in my script but I move the model under the player. I worked but lagged the game a lot GameStealerKid 79 — 3y
0
because I did this in my script but I move the model under the player. I worked but lagged the game a lot GameStealerKid 79 — 3y
Ad
Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

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.

Answer this question