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: function OnChat is confusing...

Previous Thread :: Next Thread 
shadowsoulforever is not online. shadowsoulforever
Joined: 28 Sep 2011
Total Posts: 635
22 Oct 2011 10:16 AM
Okay so to start it off I don't really use OnChat functions that much so bare with me


--:script


function drawer()
wait(2)
h("Guess the word Guessers!",4)
wait(5)
local players = game.Players:GetChildren()
it = players[math.random(1, #players)]
playerit = game.Players:findFirstChild(it.Name)
playerit.TeamColor = game.Teams.Drawer.TeamColor
game.Lighting.wordGUI:clone().Parent = playerit.PlayerGui
a(words[math.random(#words)])
playerit.PlayerGui.wordGUI.TextLabel.Text = playerit.PlayerGui.wordGUI.TextLabel.Text..game.Workspace.Word.Value
game.Lighting.Clear:clone().Parent = playerit.Backpack
game.Lighting.Paint:clone().Parent = playerit.Backpack
playerit.Character.Torso.CFrame = game.Workspace.DrawBox.text.CFrame + Vector3.new(0,0,3)
m("The drawer is "..it.Name,2)
wait(0.45)
for minutes = 0, 0, -1 do
for seconds = 59, 0, -1 do
wait(1)
if seconds < 10 then
s(minutes..":0"..seconds)
else
s(minutes..":"..seconds)
end
end
end
playerit.Character.Torso.CFrame = game.Workspace.DrawBox.box.CFrame + Vector3.new(0,0,3)
playerit.Backpack.Paint:remove()
playerit.Backpack.Clear:remove()
playerit.PlayerGui.wordGUI:remove()
cleanup()
end



--m is a Function

But I need a OnChat function to only work in this function, don't direct to http://wiki.roblox.com/index.php/Using_the_Chatted_Event

or this

http://wiki.roblox.com/index.php/How_To:_Admin_Commands


I need help.
Report Abuse
shadowsoulforever is not online. shadowsoulforever
Joined: 28 Sep 2011
Total Posts: 635
22 Oct 2011 10:18 AM
BTW this is a pictionary game.
Report Abuse
shadowsoulforever is not online. shadowsoulforever
Joined: 28 Sep 2011
Total Posts: 635
22 Oct 2011 10:30 AM
BUMP!
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
22 Oct 2011 10:45 AM
i think this info is correct, but its been a little while.


.chatted event is acutally pretty simple

function player(p)-- so the chatted event works on everyone
function chat(msg)
print(msg)-- will print what the person said

if string.sub(1,5,msg) == "hello" then -- string.sub can be used to only accept a certain amount of characters, making it easier to check if someone said "hello" the '1,5,msg' '1' is the first character '5' is the last and 'msg' is what the player said, so now it checks the first 5 letters of which you said.
print("hello to you to!")
end -- end of if statement

end -- end of chatted
end -- end of playeradded
p.Chatted:connect(chat) -- connection line to chatted event
game.Players.PlayerAdded:connect(player)--connection line for the playeradded event
Report Abuse
shadowsoulforever is not online. shadowsoulforever
Joined: 28 Sep 2011
Total Posts: 635
22 Oct 2011 11:18 AM
Doesn't work.
Report Abuse
shadowsoulforever is not online. shadowsoulforever
Joined: 28 Sep 2011
Total Posts: 635
22 Oct 2011 11:32 AM
Please help.
Report Abuse
swmaniac is not online. swmaniac
Joined: 28 Jun 2008
Total Posts: 15773
22 Oct 2011 11:33 AM
Uh, nothing in that script you posted has anything to do with the .Chatted event.

What do you want us to do?
Report Abuse
shadowsoulforever is not online. shadowsoulforever
Joined: 28 Sep 2011
Total Posts: 635
22 Oct 2011 11:35 AM
Okay I said bare with me I need help like how I would insert that script into the script in my function there.
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