So I have a remote event that a server script fires when the player leaves a vehicle. The remote event is supposed to fire and then cause a local script that's in the player to delete itself after reseting the camera and other settings. Here's the code in the server script:

--This code is in a for loop that iterates through all the players in the Player Service
Plyr.Character.Humanoid.StateChanged:connect(function(_, State)
	if State == Enum.HumanoidStateType.Jumping and (playerInVehicle == Plyr) then
		Plyr.Character.Humanoid.Jump = false
		
		seatWeld:Destroy()

		local onDeselected = tankClone:WaitForChild("onDeselected")
		onDeselected:FireClient(Plyr) --"Plyr" is the current element (Player) that the for loop is on. This is supposed to make the event in the local script fire
		
		Plyr.Character.Torso.CFrame = Engine.CFrame * CFrame.new(-15, 0, 0) --The lines below still run, which means that the script is finding the event, I think.
		
		playerInVehicle = nil
	end
end)

Here's the code in the local script:

--"onDeselected" is the name of the remote event that gets fired
onDeselected.OnClientEvent:connect(function()
	print("Fired")
	Active = false
	
	UIS.MouseBehavior = Enum.MouseBehavior.Default
	Cam.CameraType = Enum.CameraType.Custom
	
	BG.maxTorque = Vector3.new()
	
	for _, c in pairs(Connections) do
		c:disconnect()
		c = nil
	end
	Connections = {}
	
	script:Destroy()
end)

I'm not getting any errors in the output. I know it's not firing because the word "Fired" isn't showing up in the output either. Any suggestions?

6 comments

0

Maybe it's line 7 of first script, if it never showed up it wouldn't finish the script

0

No, the lines below that still work

0

I don't see any fires. In the server script to fire the local

0

line 7 is the one that fires the event. It says ":FireClient(Plyr)"

0

FireClient has a second variant. I'm not sure if this is nil, but you may want to check it.

0

I don't know what you meant by that. Explain further