Client Not Receiving Events?

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.
image

However whenever the Server Fires the event, the client doesn’t
output anything, as seen here:
image

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!

1 Like

In the local script change FindFirstChild when getting the events to be WaitForChild

pretty much experiencing the same thing as you are
idk if studio is working well rn because my character becoming r15 despite having r6 only settings

make sure the Server Script is not in Replicated Storage. because Scripts don’t work in Replicated Storage.

The Server Scripts are Inside of the Workspace

Where is the local script located at?

image
Both are parented to a “VeichleSeat” in the workspace

image
I tried doing WaitForChild but it still doesn’t print anything
image

Yes, that’s the reason it’s not working, local script does not run in server environment, Put it anywhere in StarterGui, StarterPlayerScripts, etc (client environment)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.