Remote event not working

Idk im on my verge of giving up roblox game developing and mainly roblox programming because you literally need remote events everywhere.

When you check my profile this isnt the first post i have created because of remote events.

1 Like

Wait something i just realised is that the destroying of the gui is before the print try switching the print and gui destroy around

Still no response from dev console as usual

That wouldn’t fix the script at all, because if he destroys the UI object, it simply would keep running because the server is handling the process now. It’s merely for debugging purposes. If it’s not running, the RemoteEvent never ran in the first place.

1 Like

I might have found a solution just now.

Instead of calling the RemoteEvent directly, like so:

game.ReplicatedStorage.RemoteEventPressAnyKeyToStartTheGame:FireServer()

Maybe try defining the location of the RemoteEvent within a variable and then firing the server that way.

local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEventPressAnyKeyToStartTheGame")

-- do your event stuff --

Doubt this would fix anything but it’s food for thought, I suppose.

For extra measure, make sure you define it the same way on the server.

p.s heading to sleep now. gn

1 Like

I dont know could be the right way to call in the variable. Btw your post is 69th nice.

Oh, if you set a RemoteEvent into a variable, simply fire it like this:

Remote:FireServer()

Just re-read. Just put your variable as the thing I put here. You can put it in the enclosing function or you can leave it at the top of the screen. It doesn’t really matter how you do it.

Ok so i did it and the local script now looks like this

local GUI = script.Parent
local userinputservice = game:GetService("UserInputService")
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEventPressAnyKeyToStartTheGame")

userinputservice.InputBegan:Connect(function(input, gameProcessedEvent)
	

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

	end





end)

This seems all good to go. Nothing in this script is really making any sense as to why it wouldn’t work besides the fact you’re not using Enum.KeyCode for this.

I’ve never seen anyone do it the way you’re doing it atm. I’d simply hook it to one key, such as Spacebar or Enter to dismiss a UI.

I have to sleep now, but Google (and other people’s replies) are your friends.

Still nothing. I published it. Saved it. Still nothing from dev console or the game. Although it works perfectly fine in roblox studio.

1 Like

Only think I can further recommend is to switch to the way you’re handling inputs.

I’d do something like this instead:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(KeyCode) -- not too sure why people put the extra argument here but eh.

if KeyCode == Enum.KeyCode.Enter then
       Remote:FireServer()
end

-- typed this on phone, sorry for any weird formatting or possible errors. I highly recommend reading from the actual InputBegan devhub article
end)

If all else fails, this is most likely an engine bug. I’d reinstall studio to make sure your version isn’t having an issue with “false publishing”.

1 Like