Code doesn't detect remoteevent in replicatedstorage

The code doesn’t detect where’s the remote event

[THIS SCRIPT IS LOCATED IN REPLICATEDFIRST]

local TS = game:GetService("TweenService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage:FindFirstChild("wsg")

if event and event:IsA("RemoteEvent") then
	print("yes")
else
	warn("The 'e' event was not found in ReplicatedStorage.")
end

local replicatedFirst = game:GetService("ReplicatedFirst")
local contentProvider = game:GetService("ContentProvider")


local player = game.Players.LocalPlayer

replicatedFirst:RemoveDefaultLoadingScreen()

while not game:IsLoaded() do
	task.wait()
end

local gameAssets = workspace:GetDescendants()
local loadingScreen = script.LoadingScreen:Clone()
loadingScreen.Parent = player.PlayerGui
local loadingBar = loadingScreen.Frame.LoadingBarParent.LoadingBar

local skipEnabled = false
local finished = false
local touchable = false

local function functionFinish()
	if finished == false then
		finished = true
		script.Done:Play()
		task.wait(1)
		TS:Create(loadingScreen.Cover, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), {Transparency = 0}):Play()
		task.wait(4)
		--loadingScreen.Cover:TweenPosition(UDim2.new(0, 0,-1, 0), "InOut", "Exponential", 3)
		local uncover = TS:Create(loadingScreen.Cover, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), {Transparency = 1})
		uncover:Play()
		
		for i, guiObj in pairs(loadingScreen:GetChildren()) do
			if guiObj.Name ~= "Cover" then
				guiObj.Visible = false
			end
		end
		uncover.Completed:Connect(function()
			loadingScreen:Destroy()
		end)
	end
end

for i = 1, #gameAssets do
	local asset = gameAssets[i]
	local perc;
	
	perc = math.round(i/#gameAssets*100)
	if finished then
		perc = 100
	end
	contentProvider:PreloadAsync({asset})
	
	loadingScreen["Content Provider"].Text = "Content Provider Assets Number Loading: "..perc.."%"
	loadingScreen["Assets Loaded"].Text = "Assets Loaded: "..i.."/"..#gameAssets
	
	loadingBar:TweenPosition(UDim2.new((-1 + (0 - -1) * perc / 100), 0, loadingBar.Position.Y.Scale, 0), "InOut", "Linear", 0.1)
	
	if i % 25 then
		task.wait()
	end
	if i == #gameAssets then
		perc = 100
		TS:Create(loadingScreen["Space To skip"], TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), {TextTransparency = 1, Position = UDim2.new(0.435, 0,0.72, 0)}):Play()
		touchable = true
		task.wait(1)
	end
	if i > (#gameAssets/5) and finished == false then
		if skipEnabled == false then
			TS:Create(loadingScreen["Space To skip"], TweenInfo.new(2, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), {TextTransparency = 0, Position = UDim2.new(0.435, 0,0.722, 0)}):Play()
		end
		skipEnabled = true
		
		game:GetService("UserInputService").InputBegan:Connect(function(input, gpe)
			if not gpe and input.KeyCode == Enum.KeyCode.Space then
				functionFinish()
			end
		end)
	end
end

skipEnabled = true
functionFinish()

It just warns and says
image
when the event is right here
image
does anybody know the solution

try yielding for the Event

replicatedStorage:WaitForChild("wsg")

Thanks , I didn’t know it was only this

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