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?