Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My "Admin" Chat Commands not working?

Asked by 2 years ago
Edited 2 years ago

So I have been trying to do chat commands for the admins in my game. I have made a print command which will print what ever you put in the brackets. Now I made that as a test and I actually want to make a require command which will fire a remote with the require in the remote. This is the print script :

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        if message ~= "print" then
            print(message,"")
        end

    end)

end)

It works flawlessly and can print any message that contains print but this require script:

remote = game.Workspace.RemoteEvent
game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        if message ~= "require" then
            remote:FireServer(message,"")
        end

    end)

end)

Doesnt work and gives me this error
FireServer can only be called from the client

Any suggestions?

0
You're doing it on server SuperPuiu 497 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Use a bindable event or require it from the admin commands script.

Your code is being ran from the server, which is inaccessible to :FireServer.

And is probably accessible to the functions you were trying to access with :FireServer.

Ad

Answer this question