-- 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)
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 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