Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my remote event working?

Asked by 8 years ago

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?

0
Maybe it's line 7 of first script, if it never showed up it wouldn't finish the script User#5978 25 — 8y
0
No, the lines below that still work TurboFusion 1821 — 8y
0
I don't see any fires. In the server script to fire the local User#5978 25 — 8y
0
line 7 is the one that fires the event. It says ":FireClient(Plyr)" TurboFusion 1821 — 8y
View all comments (2 more)
0
FireClient has a second variant. I'm not sure if this is nil, but you may want to check it. HungryJaffer 1246 — 8y
0
I don't know what you meant by that. Explain further TurboFusion 1821 — 8y

Answer this question