How to trigger an anonymous phone call (for a silent alarm) using ProximityPrompt and Firestone's radio?

Hello,

Sorry if I am asking too much, but I was wondering how I could trigger a phone call by pressing a button (or in this case interacting with a proximity prompt) to emergency services using Firestone’s radio? I am going to try and build a silent alarm system for a bank in my game, and I was hoping that if you press the button, then the players on the police team get a call.

1)


1)For those of you not familiar with the firestone radio, this is the emergency services menu in the phone, you type in the location, and situation. 2)When you submit it players on the emergency services teams get a notification, where they can join the call.
2)

What I think needs to happen is that the proximity prompt triggers the event that pressing “PD” would on the phone

gui.Main.Emergency.PD.MouseButton1Click:connect(function()
	if not check() then return end
	game.ReplicatedStorage.GameplayUIs.Radio.newCall:FireServer("PD", gui.Main.Emergency.Desc.Text, gui.Main.Emergency.Loc.Text)
	switchFunctions["Emergency"]()
end)

I honestly do not know where do start, any thoughts? (I am pretty new, alright very very new to scripting, [I am better at building things] I understand some of it, I know what the scripts do, I know remote events, waitforchild, getchildren, etc.)

-Thanks in advance

Assuming “PD” means police department, you would want to fire the remote event with similar information whenever someone starts to rob the bank.

Since you can only fire the server from the client (the player), you would need the function to be client sided.

--- Local Script inside of starter gui or starter player scripts
local RobberyText = "Change this to whatever you want when the bank is being robbed!"
local LocationText = "Change this to where you want the location to be at, for example the bank."
--- You need to put a click detector inside the part you want for this to work
local Part = game.Workspace.ButtonPart --- Change this to the part you press to trigger the alarm
local ClickDetector = Part.ClickDetector
---
Cooldown = 1 --- Change this to the cooldown time in seconds.
Debounce = false
ClickDetector.MouseClick:Connect(function()
   if not Debounce then Debounce = true
        	game.ReplicatedStorage.GameplayUIs.Radio.newCall:FireServer("PD", RobberyText, LocationText)
                wait(Cooldown)
                Debounce = false
   end
end)



The problems with this code however is that the alarm can be triggered whenever and multiple times.
If you want it so that the part is touched instead of clicked change “ClickDetector.MouseClick” to “Part.Touched”

1 Like

Great! Thank you so much, it works great. Now, my only problem is that I converted it to proximity prompt, but it doesn’t work when I change it. Any thoughts as to why?

--- Local Script inside of starter gui or starter player scripts
local RobberyText = "Silent alarm activated"
local LocationText = "Bank"
--- You need to put a click detector inside the part you want for this to work
local Part = game.Workspace.Button --- Change this to the part you press to trigger the alarm
local ProximityPrompt = Part.ProximityPrompt
---
Cooldown = 1 --- Change this to the cooldown time in seconds.
Debounce = false
ProximityPrompt.Triggered:Connect(function()
	if not Debounce then Debounce = true
		game.ReplicatedStorage.GameplayUIs.Radio.newCall:FireServer("PD", RobberyText, LocationText)
		wait(Cooldown)
		Debounce = false
	end
end)

There’s a couple solutions I can think of from the top of my head although they may not work.

#1 The script may have loaded before the part and proximity prompt have, so convert this:

local Part = game.Workspace.Button --- Change this to the part you press to trigger the alarm
local ProximityPrompt = Part.ProximityPrompt

to this:

local Part = game.Workspace:WaitForChild("Button") --- Change this to the part you press to trigger the alarm
local ProximityPrompt = Part:WaitForChild("ProximityPrompt")

#2 Maybe proximity prompts cant be triggered on the client so add a server script inside the proximity prompt and a remote event called “BankPromptTriggered” into replicated storage.

The following is what you need to paste into the server script.

game.Workspace:WaitForChild("Button"):WaitForChild("ProximityPrompt").Triggered:Connect(function(Player)
    game.ReplicatedStorage.BankPromptTriggered:FireClient(Player)
end)

The following is what you want to overwrite into your local script.

--- Local Script inside of starter gui or starter player scripts
local RobberyText = "Silent alarm activated"
local LocationText = "Bank"
---
Cooldown = 1 --- Change this to the cooldown time in seconds.
Debounce = false
game.ReplicatedStorage:WaitForChild("BankPromptTriggered").OnClientEvent:Connect(function()
	if not Debounce then Debounce = true
		game.ReplicatedStorage.GameplayUIs.Radio.newCall:FireServer("PD", RobberyText, LocationText)
		wait(Cooldown)
		Debounce = false
	end
end)

I hope this helps and if It doesn’t then get back to me with your output window to check for any errors and ensure all names are correct.

Sorry for the late reply, changing it to waitforchild worked! I greatly appreciate your help.