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

Simple OnClientEvent not Firing?

Asked by 4 years ago

Hey all!

So I've been making a server script where a bunch of conditions are checked, and if true, it fires a remote event on the client. There are no errors in the output. It says all the conditions are checked. But in the LocalScript where there's the OnClientEvent that's supposed to receive it, nothing happens when it is fired. Here's a snippet from the server script that fires it:

if part:FindFirstChild("BodyPosition") == nil then
        bp = Instance.new("BodyPosition", part) 
        bp.position = hole.Position    
        bp.maxForce = Vector3.new(9001, 9001, 9001)
            print(part.Name)
    if part.Name == "HumanoidRootPart" then
        print("HumanoidRootPart Located.")
        print(part.Parent.Name)
        if game.Players:FindFirstChild(part.Parent.Name) then -- Player exists
            print("Actual Player Located.")
            player = game.Players:FindFirstChild(part.Parent.Name)
            print(player.Name)
            game.ReplicatedStorage.AntiAirBubble:FireClient(player, part)
            print("Firing process complete")
        end
    end
end  -- End if

Aaand here's the LocalScript that is supposed to receive it. It doesn't print like it is supposed to do or anything else.

game.ReplicatedStorage.AntiAirBubble.OnClientEvent:Connect(function(part)
    print("fired")
end)

It's simple and I've looked all over the internet for answers. Please help!

Thanks!

0
One thing that might effect it is where its placed. Where did you place the scripts? fighterkirbyzx 102 — 4y
0
The ServerScript is in a part in workspace. The LocalScript is in ServerScriptService. The RemoteEvent is in ReplicatedStorage. These are all recommended locations and locations I've used in the past for remote events. Although this is my first time using them to go Server --> Client proqrammed 285 — 4y

Answer this question