generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: I need help q.q

Previous Thread :: Next Thread 
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:25 PM
So , I made a function, but I want to be able to chat something to call it.

I don't know how to connect chatting to the function, and I also want it so that it's only me that can say it and connect it?

If this makes sense let me know
Report Abuse
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:26 PM
I guess kinda like an admin command, but for me only
Report Abuse
iJacobness is not online. iJacobness
Joined: 20 Jan 2014
Total Posts: 4944
19 Jan 2017 06:27 PM
basically player.Chatted(msg)


Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
19 Jan 2017 06:29 PM
Use Chatted and check if the player name that chatted is equal to yours. Then run it
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
19 Jan 2017 06:30 PM
Use the example for setting only for a player

http://wiki.roblox.com/index.php?title=API:Class/Player/Chatted
Report Abuse
TheNewTARDIS is not online. TheNewTARDIS
Joined: 26 Jan 2013
Total Posts: 31
19 Jan 2017 06:37 PM
I made it a little fancier with support for arguments since you didn't specify whether or not you wanted that. It just takes the part of the message after the command string and uses that as the arguments to your function.

game.Players.PlayerAdded:connect(function(player)
if player.Name == "Revelted" then
player.Chatted:connect(function(message)
local command = "!myfunction " -- Change command string by changing this.
if message:lower():sub(1,command:len()) == command:lower() then
MyFunction(message:sub(command:len()+1, -1)) -- Args for command.
end
end)
end
end
Report Abuse
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:40 PM
Im a newbie scripter, so i wanna stick with something basic q.q
Report Abuse
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:42 PM
@Tardis


How does that connect to my function?
Report Abuse
TheNewTARDIS is not online. TheNewTARDIS
Joined: 26 Jan 2013
Total Posts: 31
19 Jan 2017 06:44 PM
It's not as scary as it looks and I really recommend breaking it down, but here's a barebones version that doesn't take arguments and the command has to literally match your message (case sensitive and stuff):

game.Players.PlayerAdded:connect(function(player)
if player.Name == "Revelted" then
player.Chatted:connect(function(message)
if message == "!myfunction" then
MyFunction()
end
end)
end
end
Report Abuse
TheNewTARDIS is not online. TheNewTARDIS
Joined: 26 Jan 2013
Total Posts: 31
19 Jan 2017 06:45 PM
@Rev

It connects to your function where it calls MyFunction().
Report Abuse
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:45 PM
OOOOHHHH i get it now
Report Abuse
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:48 PM
So I have this

game.Players.PlayerAdded:connect(function(player)
if player.Name == "Player1" then
player.Chatted:connect(function(message)
if message == "huh" then
SpawningFire()
end
end)
end
end)


but when I say huh in testing mode, it doesnt work, nor does it give an error
Report Abuse
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
19 Jan 2017 06:50 PM
nvm i put it at the bottom of my script when it needs to be at the top
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image