Cloned server script with OnServerEvent won't work?

So I made a script that automatically assigns certain objects to specific locations.
The local script gets cloned to playerGui while the server script is then cloned to server storage.

The remote event that will be used will not be cloned and is in Replicated Storage.
For some reason, After cloning the objects, the local script does fire the event while the cloned server script with OnServerEvent won’t even work.

The objects get cloned to each player by using game.Players.PlayerAdded. Take note that the scripts are originally disabled to prevent it from working. It’ll only get enabled when It’s already cloned to their specific location.

I will be showing you the clips as well as scripts to visualize what I meant.

local Script
local StartRemote = replicatedStorage:WaitForChild("RemoteFold").Remote1
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.C then	
			print("KEYDOWN")
				StartRemote:FireServer()						
	end
end)
Server Script and the Script that will clone the objects

Server Script (The one that will catch the event fired by the cloned local script)

local Remote = replicatedStorage:WaitForChild("Modes").Remote1

Remote.OnServerEvent:Connect(function(Player)
	print("Fired The remote!")

end)

Clone Handler (The script that will clone the object to their locations)

local MainScript = script.Parent.MainScript
local SubScript = script.Parent.UIS
local SStorage = game:GetService("ServerStorage")
local PlayerDataFolder = SStorage:WaitForChild("PlayerData")


game.Players.PlayerAdded:Connect(function(Player)
	local UserId = Player.UserId


	local ClonedScript = MainScript:Clone()
	ClonedScript.Parent = PlayerDataFolder:WaitForChild(UserId):WaitForChild("Modes")
	ClonedScript.Disabled = false
	

	local ClonedLocalScript = SubScript:Clone()
	ClonedLocalScript.Parent = Player:WaitForChild("PlayerGui")
	ClonedLocalScript.Disabled = false
	
end)
First Video

This video shows that the scripts have been successfully cloned to their location.
Notice that when I press the assigned key bind it does print “KEYDOWN” which indicates that it’s successfully working and detecting player input and has also fired the remote. However, the serverscript at Server Storage won’t catch the fired remote.

It should’ve also printed “Fired The remote!” which should work when the OnServerEvent worked but It didn’t.

Scripts don’t run in ServerStorage. You need to parent it to ServerScriptService instead.

I’m trying to store it to a player’s folder which is in server storage, Is moving that folder to ServerScriptService to make the scripts work a good idea?

If you want each player to have their own clone of the script you could just clone it to their Player.Character and it would run ok.

Yeah but the problem is exploiters would be able to see the scripts since it’s not in a server sided storage

I agree, which is why I said to put it in ServerScriptService. You can make a folder in there for each player I guess, just make sure you tidy up when the player leaves and delete it.

Thanks for the solution! I’ll try doing the one you said.

They would only be privy to the existence of the scripts, they wouldn’t be able to view the code of those server scripts, they are abstracted from the client (compiled on the server not the client).

One issue with a folder parented to the player’s character is that the folder is wiped each time the player’s character is added/loaded etc.

Folders parented to the player instance itself do not wipe until that particular player instance leaves the game.

Yeah I purposely parented the script there since I need that script to restart whenever the player dies/resets.