|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 27 Dec 2015 06:18 PM |
| @Jarod, But yet it works for my custom chat in all my game's. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2015 06:19 PM |
| Well I thought that players have CFrames not positions but i guess thats for teleporting only? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 27 Dec 2015 06:21 PM |
| All BaseParts (i.e. all parts) have CFrame AND Position values. |
|
|
| Report Abuse |
|
|