Hey, I’m trying to make a Prison game where if your an Inmate the Proximity Prompt gets disabled for the opening/closing of the door and for Police the Proximity Prompt is enabled. I have multiple doors with the same name and I’m trying to make 1 script target all of those doors. I’m super new to Scripting but this is what I so far.
local Player = game.Players.LocalPlayer
if Player.TeamColor == BrickColor.new("Dark blue") then
for index, object in next, game.Workspace:GetChildren() do
if object:IsA('ProximityPrompt') then
if object.Name == 'DoorPrompt' then
object.Enabled = true
elseif Player.TeamColor == BrickColor.new("Deep orange") then
for index, object in next, game.Workspace:GetChildren() do
if object:IsA('ProximityPrompt') then
if object.Name == 'DoorPrompt' then
object.Enabled = false
end
end
end
end
end
end
local Player = game.Players.LocalPlayer
if Player.TeamColor == BrickColor.new("Dark blue") then
for index, object in next, game.Workspace:GetDescendants() do
if object:IsA("ProximityPrompt") then
if object.Name == "DoorPrompt" then
object.Enabled = true
end
end
end
elseif Player.TeamColor == BrickColor.new("Deep orange") then
for index, object in next, game.Workspace:GetDescendants() do
if object:IsA('ProximityPrompt') then
if object.Name == 'DoorPrompt' then
object.Enabled = false
end
end
end
end
Did you use the updated code? I updated it recently. Also, make sure it’s a localscript and it’s somewhere like startergui and not workspace or serverscriptservice
Even if the prompt is disabled, an exploiter can still activate it. Make sure to have a check on the server to see if the user activating it is in the correct team as well.