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: OnChat Ambient Color Change

Previous Thread :: Next Thread 
Skaipe is not online. Skaipe
Joined: 31 Dec 2011
Total Posts: 6
10 Jan 2012 06:33 PM
function onChatted(msg, speaker)

source = string.lower(speaker.Name)
msg = string.lower(msg)

if msg == "blue" then
game.Lighting.Ambient = Color3.new(0,0,255)
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)


--How do I make it where I can only say it? No one else. And I don't want it for when I enter. I'll be in the game already.
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
10 Jan 2012 06:37 PM
Just get rid of the 'onPlayerEntered' function and change the connection line to this:

game.Players.Skaipe.Chatted:connect(function(msg) onChatted(msg, game.Players.Skaipe) end)

"I WILL GIVE YOU BACON." - Deadmau5
~Scarfacial
Report Abuse
Skaipe is not online. Skaipe
Joined: 31 Dec 2011
Total Posts: 6
10 Jan 2012 06:38 PM
--So it'll be this?


game.Players.Skaipe.Chatted:connect(function(msg) onChatted(msg, game.Players.Skaipe) end)

source = string.lower(speaker.Name)
msg = string.lower(msg)

if msg == "blue" then
game.Lighting.Ambient = Color3.new(0,0,255)
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end)
end

game.Players.ChildAdded:connect()

Report Abuse
Penguine236 is not online. Penguine236
Joined: 13 Apr 2011
Total Posts: 1303
10 Jan 2012 06:38 PM
@scar

you clearly dont know how to script.
Report Abuse
Penguine236 is not online. Penguine236
Joined: 13 Apr 2011
Total Posts: 1303
10 Jan 2012 06:40 PM
function onChatted(msg, speaker)

source = string.lower(speaker.Name)
msg = string.lower(msg)

if msg == "blue" then
game.Lighting.Ambient = Color3.new(0,0,255)
end
end

function onPlayerEntered(newPlayer)
if newPlayer.Name=="YourNameHere" then
newPlayer.Chatted:connect(function(msg) onChatted(msg, newPlayer) end)
end
end

game.Players.ChildAdded:connect(onPlayerEntered)
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