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
 

Chatted event

Previous Thread :: Next Thread 
tootoo123456 is not online. tootoo123456
Joined: 23 Apr 2010
Total Posts: 310
27 Dec 2015 05:58 PM
OK, this should work but the thing I bet is wrong is the position variable.
It doesn't work when i type position in chat.


game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if msg=="position" then
local position=player.Character.Torso.CFrame
local message=Instance.new("Message",workspace)
message.Text="Your position is,"..position
wait(2)
message:remove()
end
end)
end)
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
27 Dec 2015 06:08 PM
Instead of a PlayerAdded event do this:

for _, player in pairs (game.Players:GetChildren()) do
--Chat Code
end
Report Abuse
tootoo123456 is not online. tootoo123456
Joined: 23 Apr 2010
Total Posts: 310
27 Dec 2015 06:10 PM
What does that code even mean? its so confusing and why would the playeradded event not work im pretty sure that's not gonna fix the problem
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Dec 2015 06:12 PM
That won't, that will even make it worse.
Is there any output? You will definitely need to call tostring on the CFrame value.
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
27 Dec 2015 06:14 PM
It works for me.

It goes through each player in a serverscript and waits for them to chat.
Report Abuse
QuintinityZero is not online. QuintinityZero
Joined: 01 Oct 2008
Total Posts: 10618
27 Dec 2015 06:15 PM
Ok, a couple problems. First you are trying to concatenation userdata (CFrame) to a string directly. You need to cast the userdata to a string first.

message.Text= "Your position is " .. tostring(position)

Also, you probably _don't_ want to print the torso's CFrame since that includes the rotation matrix. If all you want is your XYZ position, change the line to

local position = player.Character.Torso.Position
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Dec 2015 06:16 PM
"It goes through each player in a serverscript and waits for them to chat."
Yeah, but it won't do it on any new players that join. And since it is highly probable that this will run before a player even connects, it won't work at all.
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
27 Dec 2015 06:18 PM
@Jarod, But yet it works for my custom chat in all my game's.
Report Abuse
tootoo123456 is not online. tootoo123456
Joined: 23 Apr 2010
Total Posts: 310
27 Dec 2015 06:19 PM
Well I thought that players have CFrames not positions but i guess thats for teleporting only?
Report Abuse
QuintinityZero is not online. QuintinityZero
Joined: 01 Oct 2008
Total Posts: 10618
27 Dec 2015 06:21 PM
Position is a Vector3 value that stores the xyz position.
CFrame is a CFrame value that stores the xyz position PLUS the rotation information.
Report Abuse
direMitten is not online. direMitten
Joined: 18 Jun 2015
Total Posts: 1294
27 Dec 2015 06:21 PM
All BaseParts (i.e. all parts) have CFrame AND Position values.
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