Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Server is not awnsering Local script?

So basically the server script is not detecting when the remote event is being fired, do anyone know what is wrong?

--local
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local create = ReplicatedStorage.Events.create

local player = game.Players.LocalPlayer

local playernam = player.name

  

function onKeyPress(inputObject, gameProcessedEvent)

if inputObject.KeyCode == Enum.KeyCode.Q then

create:FireServer()

print("this is local")

end

end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

Everything seems right to the local script, it is printing.

--server
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local create = ReplicatedStorage.Events.create

local Workspace = game:GetService("Workspace")

create.Name = "createsuit"

local function Make()

print("this is server")

end

  

create.OnServerEvent:Connect(Make)

Now the server script does nothing and there are no console errors, it is located in Replicated Storage...

2 comments

0

Mybe its becuase "connect" is deprecated (or that could just be a typo)

0

yeah, server connect is different, but even after changing it, nothing happens...

1 answer

✓ Accepted answer

Heres My Set Up

In the LocalScript I put

game:GetService("UserInputService").InputBegan:Connect(function(Key, Chat)

    if Key.KeyCode == Enum.KeyCode.R and not Chat then

	    game.ReplicatedStorage:WaitForChild("Create"):FireServer()

	    print("Local")

    end

end)

And in the Server Script i put

game.ReplicatedStorage.Create.OnServerEvent:Connect(function(Player)

    print("Server")

end)

https://developer.roblox.com/api-reference/class/RemoteEvent

5 comments

0

Worked Fine

0

are you intending to rename the remote event name "create",because "create.Name = "createsuit"" renames it

0

What? i just named it create because i wanted to name it create makes it easier

0

I noticed i did a few things wrong, thank you! Also, why is the "and not Chat" for?

1

So it doesnt fire when your typing

This discussion is preserved as it was. New answers, comments, and votes are closed.