gamert7Join Date: 2008-11-18 Post Count: 4986 |
code:
if Msg:sub(1, 3) == "#pm" then local player = Msg:sub(4) then w = game.Players:FindFirstChild(player) if w then
screen = Instance.new("ScreenGui", player.PlayerGui)
screen.Name = "PM"
text = Instance.new("TexetLabel", screen)
text.Size = UDim2.new(0, 1200, 0, 30)
text.Name = "Messege"
text.Font = "ArialBold"
text.FontSize="Size24"
text.Position = UDim2.new(0, 200, 0, 20)
text.TextColor3 =(255, 255, 255)
text.Text="[Private Message]"..Player.Name.." :"
end end --I want to know how I can get the text from the message after the players name. |
|
OldGoldieJoin Date: 2010-08-17 Post Count: 8210 |
Maybe use string.match? |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
I suppose but, I still would need a way to get rid of the name written in the message as is. As I would run into the same problem.... |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
I can not test this exactly but, maybe this would work?
if Msg:sub(1, 3) == "#pm" then local player = Msg:sub(4) then w = game.Players:FindFirstChild(player) if w then
screen = Instance.new("ScreenGui", player.PlayerGui)
screen.Name = "PM"
text = Instance.new("TexetLabel", screen)
text.Size = UDim2.new(0, 1200, 0, 30)
text.Name = "Messege"
text.Font = "ArialBold"
text.FontSize="Size24"
text.Position = UDim2.new(0, 200, 0, 20)
text.TextColor3 =(255, 255, 255)
local message = Msg:string.find(:)
text.Text="[Private Message]"..Player.Name.."" ..message.." " --That would return the rest of the message?
end end |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
bump. |
|
ball360Join Date: 2009-03-31 Post Count: 1557 |
May I see an example of a #pm command you are trying to implement? |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
Well like from another script or a example of using it? |
|
ball360Join Date: 2009-03-31 Post Count: 1557 |
Do you use it as:
"#pm player message" ? |
|
|
xP this should work.
local Check = Msg:match("^%W+%w+")
if Check == "#pm" then
local Rest = Msg:sub(Check:len()+2)
local Name = Rest:match(".-%w+")
--local Player = Game.Players:FindFirstChild(Name)
Player = true
if Player then
local Message = Rest:sub(Name:len()+2)
screen = Instance.new("ScreenGui", player.PlayerGui)
screen.Name = "PM"
text = Instance.new("TexetLabel", screen)
text.Size = UDim2.new(0.3,0,0.3,0)
text.Name = "Messege"
text.Font = "ArialBold"
text.FontSize="Size24"
text.Position = UDim2.new(0.2,0,0.2,0)
text.TextColor3 = Color3.new(255/255,255/255,255/255)
text.Text = Message
Game.Debris:AddItem(screen,5)
end
end |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
I wanted to know how to do it i didn't want it handed to me because, that way I learn nothing.... |
|
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
Didn't change anything. |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
Bump. |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
Bump. |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
[1] bump. |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
[2] Bump/ |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
[3] bump/ |
|
gamert7Join Date: 2008-11-18 Post Count: 4986 |
bumpd |
|