How do I run a fireserver in a modulescript? (or something similar)

I need to learn how to run fireserver inside of a module script my script:

RemoteEvent:FireServer(Plr, Message)

(what it does is make a player say something)

Just out of curiosity, why doesn’t the code you posted work inside a ModuleScript? I believe it should function normally, as long as you reference the RemoteEvent correctly.

1 Like

image

Are you requiring the module from a Server, or Local Script? Essentially happens when you require() a ModuleScript, is it loads the ModuleScript code into into the LocalScript/ServerScript you required it from for use.

2 Likes

i am requiring from a module script

What is requiring the module that is requiring the module? ModuleScript’s do not run unless they are called to by a Server or Local Script.

1 Like

i require it my executing it in the f9 console

Are you executing it to run on the Server, or the Client? Can I see where you are running it exactly?

1 Like

yes but i don’t know exactly what you mean

He said he was doing it from the DevConsole, so the server, OP I suggest you use BindableEvents then

1 Like

how would I do that exactly? I don’t know how

Show me the code then, so I can see exactly what it does

1 Like

[“chat”] = function(…)

local Arguments = {…}

if Arguments[1] == “GETINFO” then return {"Chat [Plr] [Message] ",“Forces a player to chat.”,“Admin”} end

local LocalPlr,ExplodedText = Arguments[1],Arguments[2]

local Targets = ConvertPlayersFromText(ExplodedText[1],LocalPlr)

local Message = ‘’

for I,Text in pairs(ExplodedText) do

if I ~= 1 then

Message = Message…(Text)

end

if I < #ExplodedText and I > 1 then

Message = Message…" "

end

end

for _,Plr in pairs(Targets) do

local lol = script.Items.chathax.Message

lol.Value = Message

script.Items.chathax.RemoteEvent:FireServer(Plr, Message.Value)

end

end,

The developer console runs code on the server, so you can’t use a RemoteEvent.

Instead of using a RemoteEvent which is for client to server communication, use a BindableEvent, who’s perpose is to send information from server to server.

To fire the event you use:

BindableEvent:Fire(Plr, Message)

To receive the event you use:

BindableEvent.Event:Connect(function(Plr, Message)

end)
1 Like

trying it now thanks for helping

1 Like

one problem i need to use onserverevent with the event. Bindable event dosent have that.

You use .Event in the place of .OnServerEvent. It does the exact same thing as .OnServerEvent, but is for BindableEvent’s.

1 Like