|
| 29 Sep 2012 01:04 PM |
So I want to ge this function to be a message function. But I cant name the function. I want it to be a message script. I think It should project to all the players at once. Not to sure. But, with I want it to get called like this... msg("text", 3, 0.05) like that. But... I cant call it with the msg() function because i had to change it with a Coroutine. So how would I call the function msg()? Instead of calling nothing. I dont know how. And I tried calling it a thread function. But it didn't help. Please help! Thanks!
coroutine.resume(coroutine.create(function(text, time, typespeed) tick:Play() pl = game.Players:GetChildren() for i = 1,#pl do s = Instance.new("ScreenGui") s.Parent = pl[i].PlayerGui s.Name = "Message" f = Instance.new("Frame") f.Parent = s f.BackgroundTransparency = 1 f.Size = UDim2.new(0.5, 0, 0.04,0) f.Position = UDim2.new(0.25, 0, 0.05, 0) f.BackgroundColor3 = Color3.new(0,0,0) f.BorderSizePixel = 0 txt = Instance.new("TextLabel") txt.Parent = f txt.FontSize = 6 txt.Font = "ArialBold" txt.TextColor3= Color3.new(1,1,1) txt.Position = UDim2.new(0.5, 0, 0.5, 0) txt.TextTransparency = 0 txt.Text = "" for u = 1,0,-0.1 do wait() f.BackgroundTransparency = u txt.TextTransparency = u end for i = 1,string.len(text),1 do txt.Text = string.sub(text,1,i) wait(typespeed) end wait(time) for u = 0,1,0.1 do wait() f.BackgroundTransparency = u txt.TextTransparency = u end s:remove() end end)) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
| |
|
|
| 29 Sep 2012 03:44 PM |
| Output Summary : Can't use msg("text", 3, 0.5) The function itself isnt message anymore. When I add, function msg(text, time, typespeed) before it, it will not work. It will sound and then no message and it will continue to do that. |
|
|
| Report Abuse |
|
|
Tenal
|
  |
| Joined: 15 May 2011 |
| Total Posts: 18684 |
|
|
| 29 Sep 2012 03:45 PM |
| It's in a coroutine, so it won't give the output anything... |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 03:46 PM |
| No it does, it wont let me call the function with msg(info). |
|
|
| Report Abuse |
|
|
|
| 29 Sep 2012 03:47 PM |
| I want it to let me call it with msg(dfladfma) so I can make it easier to do. And I want it to show to alllll the players at once. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 29 Sep 2012 09:16 PM |
What you're doing right now won't actually declare any function that the rest of your code can call, it will just declare a temporary function and start it right away without any arguments getting passed to it. What you want is something like this:
function ShowMessage(text, time, typespeed) Spawn(function()
...rest of code
end) end
Where you're declaring the function as normal, but when the fuction gets called, rather than doing the work in the call, it creates a new thread to do the work (use spawn for this as shown rather than coroutine.*), and the returns right away.
Alternatively you could just make the call blocking (that's what you call it when it may not return right away) and call it like this rather than normally when you don't want to halt the calling code:
Spawn(function() ShowMessage("Blah", 10, 0.2) end) |
|
|
| Report Abuse |
|
|