So i am trying to make it where multiple proximity prompts in multiple parts all open a GUI
but, when i activate one of the proximity prompts nothing happens and i receive no errors in the output.
I have made a script in ServerScriptStorage that checks if any proximity prompts have been triggered and if so it sends a remote event to the client which in a local script in StarterGui toggles the GUI.
I have looked for solutions but i only have found how to do it with only one proximity prompt.
This is my attempt at making script for checking the activation of the proximity prompt and sending a remote event.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local remoteEvent = ReplicatedStorage:WaitForChild("busgui")
local ProximityPromptService = game:GetService("ProximityPromptService")
local p1 = workspace["bus stops"].Folder.Part1.ProximityPrompt
p1.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p2 = workspace["bus stops"].Folder.Part2.ProximityPrompt
p2.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p3 = workspace["bus stops"].Folder.Part3.ProximityPrompt
p3.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p4 = workspace["bus stops"].Folder.Part4.ProximityPrompt
p4.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p5 = workspace["bus stops"].Folder.Part5.ProximityPrompt
p5.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p6 = workspace["bus stops"].Folder.Part6.ProximityPrompt
p1.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p7 = workspace["bus stops"].Folder.Part7.ProximityPrompt
p7.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p8 = workspace["bus stops"].Folder.Part8.ProximityPrompt
p8.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
local p9 = workspace["bus stops"].Folder.Part9.ProximityPrompt
p9.Triggered:Connect(function(player)
remoteEvent:FireClient(player)
end)
This was my attempt at making a local script for receiving the remote event and toggling the Gui.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("busgui")
remoteEvent.OnClientEvent:Connect(function()
local GUI = script.Parent:WaitForChild("Bus Gui")
GUI.Enabled = not GUI.Enabled
end)
local GUI = script.Parent:WaitForChild("Bus Gui")
GUI.TextButton.Activated:Connect(function()
GUI.Enabled = not GUI.Enabled
end)