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 » Scripting Helpers
Home Search
 

Re: Keydown function

Previous Thread :: Next Thread 
killerbunny123 is not online. killerbunny123
Joined: 12 Dec 2008
Total Posts: 1810
20 Jun 2014 06:47 PM
Trying to make a message come up when the key is pressed, won't work. could anyone fix it?

Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.KeyDown:connect(function(Key)
Colors = {"Red"}
if key:lower() == "z" then -- Change "z" to the key you want
RandomColor = Enum.ChatColor[Colors[math.random(#Colors)]]
chr = game.Players.LocalPlayer.Character
chrh = chr.Head
msg = "Hi"
game:GetService("Chat"):Chat(chrh, msg, RandomColor)
end
end)
Report Abuse
EncodedLua is not online. EncodedLua
Joined: 02 May 2012
Total Posts: 1555
20 Jun 2014 06:52 PM
I don't think the Chat service is able to call the Chat method. I think it's protected...
Report Abuse
killerbunny123 is not online. killerbunny123
Joined: 12 Dec 2008
Total Posts: 1810
20 Jun 2014 06:54 PM
I've seen it done in different games before, a certain key is pressed and a red chat bubble comes up displaying a message. It's not chatted, just pressed.
Report Abuse
IAmTheRolo is online. IAmTheRolo
Joined: 12 Nov 2013
Total Posts: 859
20 Jun 2014 07:00 PM
game:GetService("Chat"):Chat(chrh, msg, RandomColor)

Why go through the trouble of selection "Red" when you can just do "Red"? Unless, you want it to randomize between the three available colors (Blue,Green,Red)?
Report Abuse
killerbunny123 is not online. killerbunny123
Joined: 12 Dec 2008
Total Posts: 1810
20 Jun 2014 07:35 PM
i originally did, but then i just wanted red so i left it like that
Report Abuse
killerbunny123 is not online. killerbunny123
Joined: 12 Dec 2008
Total Posts: 1810
20 Jun 2014 10:35 PM
b
Report Abuse
Sithex is not online. Sithex
Joined: 30 May 2010
Total Posts: 1757
20 Jun 2014 10:46 PM
like encoded said its probably protected
the games you looked at probably have a custom built chat
Report Abuse
IAmTheRolo is online. IAmTheRolo
Joined: 12 Nov 2013
Total Posts: 859
20 Jun 2014 11:01 PM
repeat wait() until game.Players.LocalPlayer
local plyr = game.Players.LocalPlayer
local mouse = plyr:GetMouse()

mouse.KeyDown:connect(function(key)
if key == "z" then
game:GetService("Chat"):Chat(plyr.Character.Head,"Hi",2)
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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