Announcement

Collapse
No announcement yet.

Making a player run a chat command

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Making a player run a chat command

    I have made an event and I want it so that it makes the player run a command that does something serverside, is there a way to make a player run a command or is there a different way to do a client to server interaction?

    #2
    From what i've seen, I haven't personally been able to purchase the game and play around with the functions they have made, however from experience I know RemoteEvents are used for client > server communications, but the things done in chat is server-sided anyways, so all you'd have to do is run code like this on a server file

    Code:
    function HelloCommand(plr)
        AddPlayerChat(plr, "Hello there "..GetPlayerName(plr))
    end
    AddCommand("hello", HelloCommand)

    Comment


      #3
      Hey,

      Use the event in the link below to create a command that a player can use to trigger a function.



      LG
      Mastarkill

      Comment


        #4
        I dont think I explained it very well, I want to make a player run a command clientside, so when they click a button it makes them run a command, is this not possible?

        Comment


          #5
          I have got around my problem by using RemoteEvents, but being able to force a client to use a command is still something nice that could be added

          Comment


            #6
            This is very much possible, as I stated above you can use remote events




            Then all you really would need to do, is just have the function that the chat command would do, run when the remote is called
            Last edited by sl0th; 12-15-2019, 01:05 AM. Reason: more information

            Comment


              #7
              I mean making the player run the chat command automatically. e.g. the player clicks a button and then it makes them say a chat command.

              Comment


                #8

                Why do you want a button that executes a command that then executes a function if you can also execute the function directly with the button?

                Comment


                  #9
                  Originally posted by flyingpigbaby View Post
                  I mean making the player run the chat command automatically. e.g. the player clicks a button and then it makes them say a chat command.
                  There's no need to force a player to run a chat command, just make the chat command call a function, then you can call that function whenever you want to achieve the same affect as the command would.

                  Comment

                  Working...
                  X