Event is not firing when Proximity Prompt event is activated

-- Server
local RunService = game:GetService("RunService")
local Proxy = script.Parent.ProximityPrompt
local Occupied = game.ReplicatedStorage.JeepOccupied

Proxy.Triggered:Connect(function(player)
    local pos = script.Parent.Parent.JeepSeat.CFrame
    player.Character.PrimaryPart.CFrame = pos
    Occupied:FireClient(player)    
    print("Event fired from Server!") -- Prints
        -- Rest of the code

-- Client
local ContextAction = game:GetService("ContextActionService")
local Occupied = game.ReplicatedStorage.JeepOccupied
local Car = require(game.ReplicatedStorage.Car)
local newCar = Car.new()

Occupied.OnClientEvent:Connect(function()
    print("Event fired from Client!") -- Doesn't print
        -- Rest of the code

Why doesn’t Client receive event from server? Server part of the script is located in workspace, in Part of Jeep Model. Client script located in starter player scripts. I’ve tried doing the same but with FireAllClients() and put if statement to check for local player in Client part, but it’s still the same. No errors in output, only Server sided print. I honestly have no idea what is wrong.

I just replicated this in my own studio. I got the server to print and the client to print without errors. The only thing I notice that is wrong in your code is the functions don’t end with end)
image
I placed the script as a child of the ProximityPrompt, RemoteStorage as the parent of remote event ‘a’.
and the localscript in StarterPlayerScripts as you did. I looked at your code and couldn’t find anything except you forgetting to end) the functions. Maybe this was just a mistake upon copy-pasting your script to the devforum or its an actual problem in your script?

I suggest looking into the module you’re using.
image
It’s possible that the module is yielding your script and so, it doesn’t run.

1 Like

I can send you whole code of every script that I mentioned, but regarding this statement I have every end I need in my scripts, since rest of the code works fine. I mentioned it by typing “-- Rest of the code” in my scripts in the post. I’ve tried putting script as a child of Proxy Prompt as you mentioned and edited it a little to it won’t brake after this change, but results are the same. Event doesn’t fire for some reason, or it doesn’t reach client.

Here is script of module, no Yielding is used unless I missed something. I’m trying to practice with OOP so don’t mind if there is something strange in it.

local Car = {}
Car._Index = Car

function Car.new(position,model,orientation)
	local newCar = {}
	setmetatable(newCar,Car)
	newCar.Model = model
	local new = newCar.Model:Clone()
	new.PrimaryPart.Position = position
	new.PrimaryPart.Orientation = orientation
	new.Parent = game.Workspace
	print(newCar)
	return newCar
end

function Car:Boost()
	print("Function Activated!")
	self.Configurations.Speed += 30
end

return Car

Okay, that makes sense take into consideration what @JackStrauss said