How to make a team only ProximityPromt

I am trying to make the ProximityPromt to be visible to only the Brightorange team (Civilians). Its a cashier that they are able to rob like in jailbreak but, I don’t want the police team to be able to see the promt. Here is the code for the cashier I use.

local Prompt = script.Parent
local Hitbox = Prompt.Parent
local Screen = Hitbox.Parent.Screen

–// Settings //–
local MoneyToGive = 350
local waittime = 120

Prompt.Triggered:Connect(function(plr)
plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + MoneyToGive
Prompt.Enabled = false
Screen.Color = Color3.new(1, 0, 0)
wait(waittime)
Prompt.Enabled = true
Screen.Color = Color3.new(0.156863, 1, 0.00784314)

end)

Look at those possible solutions:

1 Like

I have look up alot of them but , is it possible to just change the code a bit so it can all work with that one code only?

You should add a separate LocalScript that checks their team and if they are police then make the Enabled property on the Proximity Prompt set to false. (Also, as a security check, on the script you provided add an if statement for if their team is not police then they are allowed to trigger it)

Are you trying to achieve a prompt that is only visible to a certain team or the function of the prompt being locked to a team?

You would always want the function of it to be locked either way for security checks if that’s his goal either way, since if it is changed locally for visibility, it can still be used by hackers if they just make it visible.

Yes only visible to a certain team if possible
RobloxScreenShot20221220_132710902

Its to add in theses

Yeah something like that, but can i add something to my script

For the security check, yes, for the visibility of the proximity prompt, no, since you would have to do that locally since it would be different for each player. But for the security check just do this:

local Prompt = script.Parent
local Hitbox = Prompt.Parent
local Screen = Hitbox.Parent.Screen

–// Settings //–
local MoneyToGive = 350
local waittime = 120

Prompt.Triggered:Connect(function(plr)
if plr.Team.Name ~= "Police" then 
    plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + MoneyToGive
    Prompt.Enabled = false
    Screen.Color = Color3.new(1, 0, 0)
    wait(waittime)
    Prompt.Enabled = true
    Screen.Color = Color3.new(0.156863, 1, 0.00784314)
end 
end)
2 Likes