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

I can't get a ProximityPrompt to work! Any help?

Asked by 3 years ago
Edited 3 years ago

I am trying to make a door go transparent the moment you trigger the proximity prompt, though I am having a bit of difficulty with it. The prompt itself won't even show up! I'm not sure if it's a problem with the script or something else. Any help is greatly appreciated!

local ProximityPromptService = game:GetService("ProximityPromptService")
local P = script.Parent
local Part1 = P.Parent.GarageDoor.Part1
local Part2 = P.Parent.GarageDoor.Part2
local garageOpen = false

local function onPromptTriggered(promptObject, player)
    if garageOpen then
        Part1.Transparency = 1
        Part2.Transparency = 1
        P.BrickColor = BrickColor.new(0, 255, 0)
        P.ProximityPrompt.ObjectText = "Open"
    else
        Part1.Transparency = 0
        Part2.Transparency = 0
        P.BrickColor = BrickColor.new(196, 40, 28)
        P.ProximityPrompt.ObjectText = "Close"
    end
    garageOpen = not garageOpen
end

This is a link to what the explorer tab looks like in case it is needed;

https://gyazo.com/7204b6066405f5f0b8ff9d17055be984

1 answer

Log in to vote
0
Answered by 3 years ago

Parent the Prompt to the part and trigger the function to fix your issue

Ad

Answer this question