ProximityPrompt for Specific Person Only

local TS = game:GetService("TweenService")
local Part = script.Parent
local prox = Part.ProximityPrompt
local ProxTriggered = 0

prox.Triggered:Connect(function(player) -- Player is the Player that used the Proximity Prompt
	if player.UserId == 994454489 then
		local TS = game:GetService("TweenService")
		local Part = script.Parent
		local prox = Part.ProximityPrompt
		local ProxTriggered = 0
		local function OpenTween()
			local info = TweenInfo.new(
				0.2,
				Enum.EasingStyle.Sine,
				Enum.EasingDirection.In,
				0,
				false,
				0
			)

			local goals =
				{
					Transparency = 1,
					CanCollide = false
				}

			local tween = TS:Create(Part, info, goals)

			tween:Play()
		end
		local function CloseTween()
			local info = TweenInfo.new(
				0.2,
				Enum.EasingStyle.Sine,
				Enum.EasingDirection.In,
				0,
				false,
				0
			)

			local goals =
				{
					Transparency = 0,
					CanCollide = true
				}

			local tween = TS:Create(Part, info, goals)
			tween:Play()
		end

		prox.Style = Enum.ProximityPromptStyle.Default
		prox.HoldDuration = 0.2
		prox.ActionText = "Open"
		prox.ObjectText = "Door"
		prox.Triggered:Connect(function()
			proxTriggered = proxTriggered + 1
			if proxTriggered == 1 then
				prox.ActionText = "Close"
				OpenTween()
			elseif proxTriggered > 1 then
				prox.ActionText = "Open"
				proxTriggered = 0
				CloseTween()
			end
		end)
	end
end
)

Here’s the script by the way

Can we talk in a separate place? I will add you on Roblox

1 Like