Event wont fire to the server

Im scripting GUI where when you click a button, a folder of scripts are put into your backpack.

I made a test script, one server and one client, and i added a remote event to fire on server event but for some reason it isnt firing, no matter what i do

Position of everything
RobloxStudioBeta_lC6WGdXuj2

Code (Client)
local UIS = game:GetService("UserInputService")
local Move = script.Parent.Parent["Move 1"]

UIS.InputBegan:Connect(function(input, chat)
	if chat then return end
	
	if input.KeyCode == Enum.KeyCode.Q then
		print("Q was pressed")
		Move:FireServer()
	end
end)
Code (Server)
local Move = script.Parent.Parent["Move 1"]

Move.OnServerEvent:Connect(function(plr)

print(plr.Name, "pressed Q")

end)

im not sure why the event wont fire, and there are no errors in the output. Help is appreciated, thank you for your time. :grinning:

1 Like

Scripts and local scripts don’t run in ReplicatedStorage. Move the local script to StarterGui or StarterPlayerScripts and move the script to ServerScriptService. You will have to change the code a bit to account for this.

oh im aware of this!

the GUI will move the folder into the players backpack, so the scripts should run

I’m not sure what else could be causing the issue, are you sure it’s actually being moved? Could you show a picture of the explorer?

what would you like to see specifically?

Can I see the code that you use to parent the scripts in replicated storage to the client?

I’d believe that ServerScript’s can’t run inside of the player. To resolve this, you need to move the ServerScript to ServerScriptService.

1 Like

Why are you placing them in replicatedstorage? I believe they won’t work correctly there, consider putting the serverscript in serverscriptservice and the localscript in StarterGui.

try

print(plr.Name .. "pressed Q")
1 Like

try to do this

local plr = game.Players.LocalPlayer

Move:FireServer (plr) --player parameter is missing here, maybe that’s why

1 Like

Firing the client requires a player parameter passed in the initial firing. Firing the server is different; It doesn’t require a player parameter, since it is firing for the server, not the player.

1 Like

so sorry for the late reply!


button.Activated:Connect(function()
	local folder = game.ReplicatedStorage:WaitForChild("Kindness"):Clone()
	print("Kindness was chosen!")
	for i, v in pairs(parent:GetChildren()) do
		if v:IsA("ImageButton") then
			print(v.Name)
			v.Active = false
			----------------------------
			local tween = TweenService:Create(v, TweenInfo.new(.5), {ImageTransparency = 1})
			tween:Play()
			----------------------------
		end
	end
	----------------------------
	tween:Play()
	tween.Completed:Wait()
	HealthGUI.Enabled = true	
	
	folder.Parent = player.Backpack
	
end)

all of this is in a local script

i tried this and the event still wont fire