So I have made a local script that detects if you are in a team and if you are in that specific team it will allow you to see all the proximity promts in workspace. I don’t get an error so I wonder whats the problem.
local team = game.Teams.MI5
local team2 = game.Teams["Development Team"]
local player = game:GetService("Players")
local teams = game:GetService("Teams")
player.PlayerAdded:Connect(function(player)
if player.Team == teams.MI5 then
for i,v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("ProximityPrompt") then
v.Enabled = true
end
end
end
if player.Team == teams["Development Team"] then
for i,v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("ProximityPrompt") then
v.Enabled = true
end
end
end
end)
The code seems to me like no matter what team they are on they are going to get the same prompt. If you try and use print statements to see if the script it working then you could locate where the problem is.
local team = game.Teams.MI5
local team2 = game.Teams["Development Team"]
local player = game:GetService("Players")
local teams = game:GetService("Teams")
player.PlayerAdded:Connect(function(player)
print(32)
if player.Team == teams.MI5 then
for i,v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("ProximityPrompt") then
v.Enabled = true
end
end
end
if player.Team == teams["Development Team"] then
for i,v in pairs(game.Workspace:GetDescendants()) do
print("heah")
if v:IsA("ProximityPrompt") then
v.Enabled = true
print("32r")
end
end
end
end)
Yeah, I’m not too familiar with proximity prompts but they should only interact with the client regardless of where the script is. I’m not sure but I think this may be the case.
Try doing this (change team colors to the respective team colors for Development Team and MI5)
local player = game:GetService("Players")
player.PlayerAdded:Connect(function(player)
if player.TeamColor == BrickColor.new("Bright blue") or player.TeamColor == BrickColor.new("Bright red")then
for i,v in pairs(game.Workspace:GetDescendants()) do
if v:IsA("ProximityPrompt") then
v.Enabled = true
end
end
end
end)
I wouldn’t name the variable representing “Players” player. This will 100% work if you place it in a server script in server script service, I just finished testing it.