Remote event not working

Im trying to make a script where when you press any button on your keyboard the GUI colapses and you just proceed in the game. Everything works properly when im testing in “roblox studio” but when i play the game from roblox game nothing works. Here are my scripts.

local GUI = script.Parent
local userinputservice = game:GetService("UserInputService")

userinputservice.InputBegan:Connect(function(input, gameProcessedEvent)
	game.ReplicatedStorage.RemoteEventPressAnyKeyToStartTheGame:FireServer()

	if input.UserInputType == Enum.UserInputType.Keyboard then
		print("Player has pressed keyboard")
		

	end





end)
-- This is localscript and their direct parent is StarterScreenGUI
game.ReplicatedStorage.RemoteEventPressAnyKeyToStartTheGame.OnServerEvent:Connect(function()

	player.PlayerGui.StarterScreenGUI:Destroy()
	print("Event fired")
end)

--This was a script in ServerScriptService

EDIT :

Screenshot (36)

So my server script right now is the “PressAnyKeyToStartTheGameServerScript”
And my local script is the “StarterKeyboardInputScript” (Forgot to clarify in renaming its a localscript)

1 Like

Are you getting any errors in normal game? Check your console with F9.

I checked both client and server logs in dev console but there’s nothing related to that.

Does it prints “Player has pressed keyboard”?

Nope. Nothing is printed out or executed.

Change your local script a little and add these:

print("1")
local GUI = script.StarterScreenGUI
local userinputservice = game:GetService("UserInputService")
print("2")

Check if it prints both numbers.

I strongly recommend doing this whenever you run into an error with scripts.

Just thought I’d point that out.

Absolutely agree. Debugging is extremely helpful and I learnt to do that instead of asking on the DevForum all the time, altough not everyone is aware of how to properly debug their scripts.

1 Like

Exactly, I am suprised how little scripters know this as it can be so helpful whist finding bugs and errors. I will make an in-detail post about debugging now and I will link it here later.

1 Like

And again i added that in the localscript but still no signs of activity.

Oh, it doesn’t print them? Then that means the LocalScript isn’t working at all. Can you send me the hierarchy of game please? Or at least the part with the LocalScript.

Glad someone will talk about it in-depth. Will check it out once you’re done with it.

However I might’ve found an already existing guide Guide to Debugging: Understanding Error Messages. Maybe you can write an upgraded version of it.

Alright, should be 30 minutes to an hour.

Basically my localscript is right after StarterGui and inside of localscript its just all the GUI things like frames, logos, labels if you check out my profile you can see how exactly my GUI looks.

Can you try replacing your first line with this:

local GUI = script:WaitForChild("StarterScreenGUI")

I did it and still no response in server and client logs.

I have never understood remote events they are really confusing and tutorials are unrelated to what im trying to do.

Check that scripts are not disabled. Also, why are you using a remote event for this? It does only print “Event fired”

i think you should delete the GUI by using serverscript, try to trigger the server by putting it into the if statement in localscript and proceed to delete the GUI from server

I don’t know what to suggest you anymore honestly. I tried your exact same thing and it worked fine for me.