I am trying to fire a RemoteEvent, and this is my first time ever using RemoteEvents. I am currently looking on different sites for answers, like developer.roblox.com, where they have a section for RemoteEvents, so I took code samples from there, and edited them.
Server Sided Code
local player = game.Players.LocalPlayer
local Owners = {"SkyFume"}
local Superadmins = {}
local Admins = {}
local Mods = {}
local CustomRanks = {}
game.Players.PlayerAdded:Connect(function(Player)
for i, v in pairs(Owners) do
if Player.Name == v then
local Players = game:GetService("Players")
local welcomePlayerEvent = Instance.new("RemoteEvent")
welcomePlayerEvent.Parent = game.ReplicatedStorage
welcomePlayerEvent.Name = "WelcomePlayerEvent"
local function onPlayerAdded(player)
welcomePlayerEvent:FireClient(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)
end
end
end)
Local Script Code
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local welcomePlayerEvent = ReplicatedStorage:WaitForChild("WelcomePlayerEvent")
local playerGui = player:WaitForChild("PlayerGui")
local ScreenGui = script.Parent.ScreenGui
local function onWelcomePlayerFired()
ScreenGui.Parent = playerGui
end
welcomePlayerEvent.OnClientEvent:Connect(onWelcomePlayerFired)

6 comments
This answer is the longest I had ever post (I think)
This still does not work, I did some digging- and I still found nothing? My output doesn't seem to show errors, but it seems that it fires the event, but the LocalScript doesnt receive it
Is your LocalScript located on StarterPlayer > StarterPlayerScripts? Since LocalScript does not run in Workspace or ServerScriptService.
Players.SkyFume.PlayerScripts.LocalScript:1: attempt to index nil with 'welcomePlayerEvent'. Any idea?
Did you read the big text on my answer? You should put a RemoteEvent called "welcomePlayerEvent" in ReplicatedStorage. I think that's the problem.
There is a RemoteEvent in ReplicatedStorage, it is called welcomePlayerEvent.