RemoteEvent not firing

When I press Return/Enter, this script fires a RemoteEvent thats in ReplicatedStorage.
LocalScript in StarterCharacter:

local UserInputService = game:GetService("UserInputService")
local Event = game.ReplicatedStorage:WaitForChild("StartGame")
UIS = game:GetService("UserInputService")

	if input.UserInputType == Enum.UserInputType.Keyboard then
		if Enum.KeyCode.Return then

ServerScript in ServerScriptService:

local Event = game.ReplicatedStorage.StartGame
local SGui = game.StarterGui
local player = game.Players.LocalPlayer
local H = player.Character.Humanoid
	SGui.FreezePlayer.Enabled = false
	H.WalkSpeed = 75
	H.JumpPower = 100

You arent connecting a function for the Event to fire, so it will just throw an error instead of connecting and firing

How would I connect a function? Sorry I’m new with RemoteEvents

There’s a couple of weird things going on in your script.

Why are you defining a new variable using UserInputService if you already defined it 2 lines beforehand.

You’re not checking if the the GameProcessed boolean is true/enabled, and you’re not checking to see if the keycode the user clicked is the Return/Enter key.

You’re trying to get the LocalPlayer from the server. The LocalPlayer means the player local to the client that’s running Roblox (You can only get LocalPlayer from a LocalScript).

You’re using StarterGui. The content the player sees on their screen is replicated to the player’s PlayerGui. Modifying StarterGui doesn’t change anything on the player’s screen.

You never connected a function to the RemoteEvent.

Your LocalScript should look like this:

local UserInputService = game:GetService("UserInputService")
local Event = game.ReplicatedStorage:WaitForChild("StartGame")
local PlayerGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
-- get the player's screen content

UserInputService.InputBegan:Connect(function(input, processed)
	if input.UserInputType == Enum.UserInputType.Keyboard and not processed then
        -- check if the player isn't typing anything
		if input.KeyCode == Enum.KeyCode.Return then -- check if the player pressed this key
            -- change the player's screen from the client
            PlayerGui:WaitForChild("FreezePlayer").Enabled = true -- enable the ScreenGui

And your ServerScript should look like this:

local Event = game.ReplicatedStorage.StartGame

Event.OnServerEvent:Connect(function(player) -- connect a function to the signal
    local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
    if not humanoid then -- if the player's humanoid didn't load
        return -- stop the functiuon

    humanoid.WalkSpeed = 75
    humanoid.JumpPower = 100

Thank you :+1: :+1:. I was way off lol

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