Problem with RemoteEvent (Don't know the exact problem)

Hi! Im using :FireClient() to when the player triggers the ProximityPrompt, a notification shows up

Script in ProximityPrompt:

script.Parent.Triggered:Connect(function(Player)
	game.ReplicatedStorage.Notify:FireClient(Player)
end)

LocalScript in ReplicatedFirst:

game.ReplicatedStorage.Notify.OnClientEvent:Connect(function(Player)
	game:GetService("StarterGui"):SetCore("SendNotification", {
		Title = "123",
		Text = "abc",
		Duration = 5,
	})
end)

Output error:
Notify is not a valid member of ReplicatedStorage “ReplicatedStorage” - Client - LocalScript:1

3 Likes

Try and add WaitForChild(“Notify”).

game.ReplicatedStorage:WaitForChild("Notify").OnClientEvent:Connect(function(Player)
4 Likes

First, try what the person above said and add :WaitForChild(“Notify”). If it still doesn’t work, try and move the local script into StarterGui.

2 Likes

You don’t have to be in startergui to get the service

If both solutions above dont work, move Notify to ReplicatedFirst

1 Like

On top of that, I would also replace game.ReplicatedStorage with game:GetService("ReplicatedStorage") (simply a better habit to do that).

1 Like

It didn’t work, but this time without any error in output

@incognitobot_rblx
Also didn’t work

2 Likes

Show us your explorer page and where notify event is located.

1 Like

image
before, the Notify event was in ReplicatedStorage

in workspace:
image

--SERVERSCRIPT
local RemoteEvent = game:GetService("ReplicatedStorage").Notify

script.Parent.Triggered:Connect(function(Player)
	RemoteEvent:FireClient(Player)
end)

--LOCALSCRIPT
local RemoteEvent = game:GetService("ReplicatedStorage").Notify

RemoteEvent.OnClientEvent:Connect(function(Player)
	game:GetService("StarterGui"):SetCore("SendNotification", {
		Title = "123",
		Text = "abc",
		Duration = 5,
	})
end)

Dont forget to put your LocalScript to StarterPlayerScripts or StarterCharacterScripts. Otherwise it wont work because ReplicatedFirst is essential to game’s start. Like loading screen and etc.

EDIT: Also dont forget to put your RemoteEvent to ReplicatedStorage.

2 Likes

For some reason, it didn’t, work… but I inserted some prints to check out the problem… and here is what I found out (I still need help on how to solve it)

--LOCALSCRIPT
local RemoteEvent = game:GetService("ReplicatedStorage").Notify

RemoteEvent.OnClientEvent:Connect(function(Player, Code)
    print(Player)
    print(Code)
	game:GetService("StarterGui"):SetCore("SendNotification", {
		Title = "123",
		Text = "abc",
		Duration = 5,
	})
end)
--SERVERSCRIPT
local RemoteEvent = game:GetService("ReplicatedStorage").Notify

script.Parent.Triggered:Connect(function(Player)
    print("Triggered")
	RemoteEvent:FireClient(Player, 5)
end)

OUTPUT:
image

So, when the localscript should print the player, it prints the code… and when it should print the code, it prints “nil”

I hope it helps you o help me

After doing this I got a solution!

--LOCALSCRIPT
local RemoteEvent = game:GetService("ReplicatedStorage").Notify

RemoteEvent.OnClientEvent:Connect(function(Code)
    local Player = game.Players.LocalPlayer --If needed, not necessary in this case
	game:GetService("StarterGui"):SetCore("SendNotification", {
		Title = "123",
		Text = "abc",
		Duration = 5,
	})
end)

Just removed Player form OnClientEvent function
No changes in ServerScript

Thanks for everyone that replied my post! It really helped!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.