Roblox Studio Proximity Prompt Invisible Model

102 views Asked by At

Hello i am new here and i dont know anything about coding. I want to make a model disapear/transparent with proximity prompt. Anybody can help?

I tried with click detector but nothing happened. Then tried with WaitForChild "proximity prompt" again nothing happened. Even proximity prompt UI not appear.

2

There are 2 answers

1
user15611379 On
model = workspace.Model
model:Destroy(Instance.new("ClickDetector",model).MouseClick:Wait())
0
Buage On

So first, make sure your Proximity Prompt is inside a part, if it isn't inisde a part, here is how to create one :

1 - Press CTRL + I

2 - Select "Part"

Now select your part in the explorer. When you put your mouse pointer on it, a "+" button should appear. Click on it then search for "ProximityPrompt" and click on it.

Once this is done, select your proximty prompt, and put your mouse pointer on it, then press the "+" button. Search for "Script" (NOT local script) and click on it.

It should now open the script, if it don't, double click on the script you created.

Now you can make a script like this to delete a model :

script.Parent.Triggered:Connect(function(player)
    if game.Workspace:FindFirstChild("MyModel") then -- Change MyModel to the model / part name
        game.Workspace.MyModel:Destroy() -- Change MyModel to the model / part name you want to destroy
        print("Destroyed the model")
    elseif not game.Workspace:FindFirstChild("MyModel") then
        print("Couldn't find the model to destroy.")
    end
end)

If you want to make the model transparent, you can use this script :

script.Parent.Triggered:Connect(function(player)
    if game.Workspace:FindFirstChild("MyModel") then -- Change MyModel to the model / part name
        for i, part in pairs(game.Workspace:FindFirstChild("MyModel"):GetDescendants()) do
            if part.ClassName == "Part" then
                part.Transparency = 1
                print("Made a model part transparent")
            end
        end
    elseif not game.Workspace:FindFirstChild("MyModel") then
        print("Couldn't find the model to make transparent.")
    end
end)

I hope this help !