Hello Everyone.
I wish to achieve that all proximity prompts get Disabled Whenever a player enters a Seat, however the server prints my Players Name And UserID to confirm that the “Driver” variable is indeed a player and prints “Fired Event” to also confirm that the server is Firing the event.
However whenever the Server Fires the event, the client doesn’t
output anything, as seen here:
Every time the client receives the event it is supposed to print “Received Enable Event”
as seen here in the LocalScript
enablePrompts.OnClientEvent:Connect(function(enabled)
print("Received Enable Event")
end
So here’s both the scripts:
Server Script:
local Seat = script.Parent
local Driver
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant then
local Player = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
Driver = Player
print(Driver.DisplayName.." "..Driver.UserId)
game.ReplicatedStorage.Misc.DisablePrompts:FireClient(Driver, false)
print("Fired Event")
end
if Seat.Occupant == nil then
game.ReplicatedStorage.Misc.EnablePrompts:FireClient(Driver, true)
Driver = nil
print("Fired Event")
end
end)
Local Script:
local ProximityPromptService = game:GetService("ProximityPromptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage"):WaitForChild("Misc")
local enablePrompts = ReplicatedStorage:FindFirstChild("EnablePrompts")
local disablePrompts = ReplicatedStorage:FindFirstChild("DisablePrompts")
enablePrompts.OnClientEvent:Connect(function(enabled)
print("Received Enable Event")
for i, v in workspace:GetDescendants() do
if v:IsA("ProximityPrompt") then
v.Enabled = true
end
end
end)
disablePrompts.OnClientEvent:Connect(function(enabled)
print("Disabled Enable Event")
for i, v in workspace:GetDescendants() do
if v:IsA("ProximityPrompt") then
v.Enabled = false
end
end
end)
Any Help Would Be Appreciated!