Hiding ProximityPrompts within a specific model

Hi developers!

I’m trying to get a system that will disable all the ProximityPrompts within a specific model when that player joins the game. It should only happen to those that fall in under the staff rank within a group. For now I have set it to >= 1 just for testing purposes.

The model in question is not prespawned in the game, however it should be before anyone below that staff rank gets in game.

This is what I have currently but does not work.
‘AWConnect’

LocalScript

local Player = game.Players.LocalPlayer
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	if Player:GetRankInGroup(16530381) >= 1 then
		print("Matches Group")
		for i,Connect in pairs(workspace:GetDescendants()) do  
			if Connect:WaitForChild("AWConnect").Parent then
				print("Finds AWConnect")
				for i, Prompts in pairs(Connect:GetDescendants()) do
					if Prompts.ClassName == "ProximityPrompt" then
						print("Finds Prompts")
						Prompts:Destroy()
						print("Destorys Prompts")
					end
				end
			end
		end
	end	
end)



1 Like

sorry for my older post I understood the problem wrong.
you already have a reference of the player and still use a PlayerAdded. is that intended?

Players.PlayerAdded:Connect(function(player)
	if Player:GetRankInGroup(16530381) >= 1 then
		print("Matches Group")
		for i,Connect in pairs(workspace:GetDescendants()) do  
			if Connect:WaitForChild("AWConnect").Parent then
				print("Finds AWConnect")
				--fire client here
			end
		end
	end	
end)

you can do this part in the server and for the destroying part send a “fireclient” event to the player that destroys all prompts in the model

or just do this in the server if you want this deletion to happen for everyone