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: LocalScript Functions

Previous Thread :: Next Thread 
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 01:33 AM
I made a non working script, so my friend agve me this, which i only half understand.

game.Players.LocalPlayer.Chatted:connect(function(msg) -- "Chatted" means if the person chatted.
local m = Instance.new("Message",Game.Workspace) -- "msg" must mean chat ^ UP ABOVE
m.Text = ""..msg --Argument is "msg" so thats what you put, in this, msg is what is chatted. -- MSG must be Argueing about "Chatted" so you put that after ":"
wait(3)
m:Destroy()
end)

-- ALWAYS put localscripts in GUI place :D

(Dont mind my comments,they for me)
Anyways, whoever Chats something only see's the message, I want everyone to see it.
I think it has to do with "LocalPlayer".
Also, if I did this, it completely brakes:

game.Players.LocalPlayer.Chatted:connect(function(msg) -- "Chatted" means if the person chatted.
local m = Instance.new("Message",Game.Workspace) -- "msg" must mean chat ^ UP ABOVE
m.Text = player.name.. ""..msg --Argument is "msg" so thats what you put, in this, msg is what is chatted. -- MSG must be Argueing about "Chatted" so you put that after ":"
wait(3)
m:Destroy()
end)

(I put player.name.. before the "")
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
27 Oct 2013 01:35 AM
remove this

wait(3)
m:Destroy()

and put in this

game.Debris:AddItem(m,3)
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 01:36 AM
That won't help.
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
27 Oct 2013 01:41 AM
why not you know your script is waiting 3 sec when you chated and wont detect anything that chated betwen thouse 3 sec if you add item to debris then script is done runing debris will remove msg after 3 sec
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Oct 2013 01:41 AM
player is nil
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 01:42 AM
hmm SO i would do

LocalPlayer.name.. -- Right?
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
27 Oct 2013 01:45 AM
player = game.Players.LocalPlayer
player.Chatted:connect(function(msg)
local m = Instance.new("Message", game.Workspace)
m.Text = "msg"
game.Debris:AddItem(m,3)
end)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Oct 2013 01:46 AM
Game.Players.LocalPlayer.Name -.-
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
27 Oct 2013 01:46 AM
ops

player = game.Players.LocalPlayer
player.Chatted:connect(function(msg)
local m = Instance.new("Message", game.Workspace)
m.Text = player.Name..""..msg
game.Debris:AddItem(m,3)
end)
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 02:52 AM
ok to questions.
I've seen half of that. Explain the 2 other words.

game.Debris:AddItem(m,3)

-- I need to know, whats "AddItem" It just ads that thing to debris?
Is debris something in workspace? that removes stuff?
-- and is (m,3)
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
27 Oct 2013 04:09 AM
read this
http://wiki.roblox.com/index.php/RBX.lua.Debris_%28Object%29


http://wiki.roblox.com/index.php/AddItem_%28Method%29
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 12:49 PM
Sure thing pal!
Report Abuse
kubuto2 is not online. kubuto2
Joined: 16 Jul 2008
Total Posts: 1275
27 Oct 2013 12:52 PM
game.Players.LocalPlayer.Chatted:connect(function(msg)
local m = Instance.new("Message")
m.Text = msg
m.Parent = Workspace -- parent the object after when you do stuff to it, also game is not suppose to be capitalized
wait(3)
m:Destroy()
end)
Report Abuse
kubuto2 is not online. kubuto2
Joined: 16 Jul 2008
Total Posts: 1275
27 Oct 2013 12:53 PM
BTW it won't matter if he adds it to the debris or not, it is a function "by roblox" there for a new thread.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 12:54 PM
Ok, thanks.

Using the Debris service, you can have an object automatically clean itself up after a set amount of time. It will also keep the objects from getting out of hand. Once the service is run, you can find its object on the bottom of the list in the Explorer pane in the Studio. Its parent is automatically game, and that cannot be changed. "So, when i do (m,3) its adding m to debris, then waiting 3 seconds to remove it?"

The Add Item function is used with the Debris service. When you add an item it gets added to the list of what the game considers to be clutter on the map. After the lifetime limit has expired, the item will be removed. Or, if there are too many clutter items around and you hit the MaxItems limit, the oldest items will be removed until the number of clutter objects is back under the limit. "uhhh, so it adds something to Debris?"
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
27 Oct 2013 12:56 PM
One thing, whats an "msg"??? And how would I know to make it an argument??
Report Abuse
kubuto2 is not online. kubuto2
Joined: 16 Jul 2008
Total Posts: 1275
27 Oct 2013 12:58 PM
arguments can be anything in a function, they just contain information about what event you just called.
You really change the argument to arg, message, msg. Anything you want. But it will still contain the value that the event returns. For this instance it will return what the player says. You will want to test this on online mode (Multiplayer).
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