|
| 13 Apr 2015 08:05 PM |
i have this function that I wrote which works fine when I run it in studio but then when I try to activate the function with a chatted event or a touched function it doesn't work. this is my script, please help me write the chatted event if you know how
red = game.StarterGui.RedCard.Frame green = game.StarterGui.GreenCard.Frame yellow = game.StarterGui.YellowCard.Frame blue = game.StarterGui.BlueCard.Frame
function card() local i = math.random(1,4) if i == 1 then red.Visible = true wait(5) red.Visible = false elseif i == 2 then green.Visible = true wait(5) green.Visible = false elseif i == 3 then yellow.Visible = true wait(5) yellow.Visible = false elseif i == 4 then blue.Visible = true wait(5) blue.Visible = false end end |
|
|
| Report Abuse |
|
|
acidflip
|
  |
| Joined: 18 Jul 2012 |
| Total Posts: 886 |
|
|
| 13 Apr 2015 08:10 PM |
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) -- stuff here end) end) |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2015 08:11 PM |
| yes I found that on the wiki but I don't know what to put in the --stuff here |
|
|
| Report Abuse |
|
|
iHin
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 407 |
|
|
| 13 Apr 2015 08:11 PM |
This person above me gave you to proper framework. Your script didn't call the function. For future reference, post any output statements.
-𝒩 | iHin, Scripter |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2015 08:12 PM |
| @hin I tried to call it with the framework ^^ but what I tried wasn't working so I didn't post it, hoping that somebody else would post a correct version |
|
|
| Report Abuse |
|
|
acidflip
|
  |
| Joined: 18 Jul 2012 |
| Total Posts: 886 |
|
|
| 13 Apr 2015 08:12 PM |
| put whatever your little heart desires in "--stuff here" |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2015 08:20 PM |
| lol but what I meant to say was that I want to connect to the function in the '--stuff here' part but I don't know how to say that correctly |
|
|
| Report Abuse |
|
|
acidflip
|
  |
| Joined: 18 Jul 2012 |
| Total Posts: 886 |
|
|
| 13 Apr 2015 08:22 PM |
function card() -- whatever was here end
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(card) end) |
|
|
| Report Abuse |
|
|
|
| 13 Apr 2015 08:29 PM |
| sorry I keep asking questions but what about the actual message part (where do I put what the code is?) |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 13 Apr 2015 08:30 PM |
red = game.StarterGui.RedCard.Frame green = game.StarterGui.GreenCard.Frame yellow = game.StarterGui.YellowCard.Frame blue = game.StarterGui.BlueCard.Frame
I think you want to edit the playergui, not startergui |
|
|
| Report Abuse |
|
|