Hi ! I ve a problem with my script on Roblox... I want to get the team of the player who triggered the proximity prompt of the door, but my script dont work ?? Does someone know a solution for tuhis problem ? Thanks in advance !
detector1.Triggered:Connect(function(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)
(And excuse me for my English, Im french !)
if player.Team == game.Teams["Tau'ri"] then
You could use
local function onPromptHoldEnded(promptObject, player) -- script end ProximityPromptService.PromptButtonHoldEnded:Connect(onPromptHoldEnded)
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
if player.TeamColor == game.Teams["Tau'ri"].TeamColor then