Remote Event trouble or bug?

Im trying to do fireclient but its keep saying it dont exists getting me really mad when it does exists and its there in the area im telling it to be fired from.

Screenshots.

Screenshots



image
image
image

What I tried

WaitForChild
FindFirstChild
.AdminEvent itself

Module Code

Code
local module = {}

function module.Commands()

local player = script.Parent.LocalPlayer.Value

local plr = game.Players:WaitForChild(player)

local gui = script.ScreenGui:Clone()

gui.Parent = plr.PlayerGui

wait(2)

local event = game.ReplicatedStorage.CmdsEvent

event:FireClient(player)

end

return module

Code from the Notifcations LocalScript

Code
--Simple Notifications for commands ran and to replace the guis.
--New as of 12/15/2019
--written by im_sams

local player = game.Players.LocalPlayer


local noclip = Instance.new("RemoteEvent")
noclip.Name = "NoclipEvent"
noclip.Parent = game.ReplicatedStorage

noclip.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Admin Command Ran"; 
	Text = "Hello "..player.Name..", Noclip now enabled, Press 'E' to enable and disenable noclip"; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 6; 
})



end)

local musicstart = Instance.new("RemoteEvent")
musicstart.Name = "MusicEvent2"
musicstart.Parent = game.ReplicatedStorage

musicstart.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Admin Command Ran"; 
	Text = "Hello "..player.Name..", Music succesfully started playing, Say :musicstop to stop playing"; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 6; 
})



end)


local musicend = Instance.new("RemoteEvent")
musicend.Name = "MusicEvent"
musicend.Parent = game.ReplicatedStorage

musicend.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Admin Command Ran"; 
	Text = "Hello "..player.Name..", Music succesfully stop playing"; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 6; 
})



end)



local kick = Instance.new("RemoteEvent")
kick.Name = "KickEvent"
kick.Parent = game.ReplicatedStorage

kick.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Admin Command Ran"; 
	Text = "Hello "..player.Name..", succesfully kicked the player"; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 6; 
})



end)

local fly = Instance.new("RemoteEvent")
fly.Name = "FlyEvent"
fly.Parent = game.ReplicatedStorage

fly.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Admin Command Ran"; 
	Text = "Hello "..player.Name..", succesfully toggled flying ability, Press 'F' to enable and disenable your flying ability"; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 6; 
})



end)


CmdsEvent = Instance.new("RemoteEvent")
CmdsEvent.Name = "CmdsEvent"
CmdsEvent.Parent = game.ReplicatedStorage

CmdsEvent.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Commands List"; 
	Text = "Are commands are: :fly,:musicstop,:noclip,:kick and :fly. More are coming soon"; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 9; 
})



end)



youadmin = Instance.new("RemoteEvent")
youadmin.Name = "AdminEvent"
youadmin.Parent = game.ReplicatedStorage

youadmin.OnClientEvent:connect(function(plr)
game.StarterGui:SetCore("SendNotification", {
	Title = "Admin Commands By Rampage Studios"; 
	Text = "Hello "..player.Name..", you are and administrator, type :cmds to view your abilitys."; 
	Icon = "http://www.roblox.com/asset/?id=2129408130"; 
	Duration = 15; 
})



end)
2 Likes

In your module code you wrote

Yet, the picture of the ReplicatedStorage hiearchy shows that the folder is named DefaultChatSystemChatEvents. You should change it to CmdsEvent.

As for the other errors, you should provide code on where they occured, or I can’t help you :smile:

2 Likes

I think that the problem comes from you not using WaitForChild on the event. You didn’t really specify on what you tried to use the functions on.

I made a version of your code that uses WaitForChild more, so that it should hopefully not just error.

local module = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Event = ReplicatedStorage:WaitForChild("CmdsEvent", 3)

local Player = script.Parent:WaitForChild("LocalPlayer", 3)

local Plr = Player.Value --don't know why you're referencing player twice with players:waitforchild(player)
local PlrGui = Plr:WaitForChild("PlayerGui", 3)

local Gui = script:WaitForChild("ScreenGui", 3)

function module.Commands()
	local GuiClone = Gui:Clone()
	GuiClone.Parent = PlayerGui
	
	wait(2)
	
	Event:FireClient(Plr)
end

warn("Loaded")

return module

If this doesn’t work, I don’t know what is wrong. It’s most likely you either spelling CmdsEvent wrong or it gets deleted.

2 Likes

Well when I test play look it’s there and I’m spelling correctly so i will test this when I get on pc

In the picture there is a RemoteEvent named CmdsEvent, DefaultChatSystemEvents is used by the Chat itself.

If you have a timeout, WaitForChild can still return nil. You should be checking if Event exists if you’re adding a timeout.

1 Like

I believe your problem is that you are creating the RemoteEvent after the module script tries to index it so it results in nil since it does not exist yet.

Also since you are communicating from within the same client, using a RemoteEvent is not necessary. Consider switching to using BindableEvents

I know that they return nil, I did that so he can pinpoint if the server is making the variable before the remote instance actually been made.