local detector1 = script.Parent.Parent.Model1.Detector.PromptAttachment.ProximityPrompt
local detector2 = script.Parent.Parent.Model2.Detector.PromptAttachment.ProximityPrompt
local door = script.Parent
local partDoor = script.Parent.Union
local isInAction = false
ProximityPromptService = game:GetService("ProximityPromptService")
local function open()
door.Position = Vector3.new(10430, 6.4, -431.5)
partDoor.Position = Vector3.new(10430, 6.4, -431.5)
if isInAction == false then
while door.Position ~= Vector3.new(10418, 6.4, -431.5) do
isInAction = true
door.Position = door.Position - Vector3.new(0.0625 , 0 , 0)
partDoor.Position = partDoor.Position - Vector3.new(0.0625 , 0 , 0)
wait(0.001)
end
end
isInAction = false
detector1.ActionText = "Close"
detector2.ActionText = "Close"
end
local function close()
door.Position = Vector3.new(10418, 6.4, -431.5)
partDoor.Position = Vector3.new(10418, 6.4, -431.5)
if isInAction == false then
while door.Position ~= Vector3.new(10430, 6.4, -431.5) do
isInAction = true
door.Position = door.Position + Vector3.new(0.0625 , 0 , 0)
partDoor.Position = partDoor.Position + Vector3.new(0.0625, 0 , 0)
wait(0.001)
end
end
isInAction = false
detector1.ActionText = "Open"
detector2.ActionText = "Open"
end
local function onPromptHoldEnded(promptObject, player)
if player.Team == "Tau'ri" then
if isInAction == false then
if door.Position == Vector3.new(10418, 6.4, -431.5) then
close()
else
open()
end
end
end
end
But the script of the question works when I don't want to add the condition of the player's team
1 comment
Thanks bro ! It works !