HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 07 Jun 2013 09:13 PM |
| I want to make a localscript greet people with a certain rank in a group as they enter. The problem is, it doesn't activate because the localscript's parent isn't the player's backpack/character/playergui. Any ideas as to how I could get it to work? Also the reason I am using a localscript is because they have the most most up-to-date information. |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
| |
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 07 Jun 2013 11:02 PM |
Well it's kind of obvious...? Parent it to one of the places it runs in...?
game.Players.PlayerAdded:connect(function(Plyr) Plyr:WaitForChild("PlayerGui") Bleh.Bleh.Parent = Plyr.Backpack end)
|
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 07 Jun 2013 11:23 PM |
| Another issue is the localscript is not running when it's placed into the backpack. |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 07 Jun 2013 11:31 PM |
| Then disable, and enable it again using the 'Disabled' property. Or put a 'Disabled' one into the backpack, and make the normal script enable it... |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 07 Jun 2013 11:38 PM |
| It still doesn't run like it should. Want me to paste the scripts? |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
| |
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 08 Jun 2013 02:52 AM |
| 'It still doesn't run like it should.' -> Again, explain. |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 08 Jun 2013 10:41 AM |
| I have a regular script that detects when a player is added to the game. When a player is added it copies it's child which in this case is the LocalScript and puts it in the player's backpack. The LocalScript is then supposed to run from the backpack and determine the player's rank in a group. If the player has a certain rank, the LocalScript is supposed to create a message in the Workspace welcoming that player and saying their rank. |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
| |
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 08 Jun 2013 11:29 AM |
| Can't you just put the ENABLED LocalScript in StarterGui or something? :U |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
| |
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 08 Jun 2013 11:32 AM |
| In that case I must see the script itself. |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 08 Jun 2013 02:40 PM |
Script:
game.Players.PlayerAdded:connect(function(p) local g = script:children() for i = 1, #g do if g[i].className == "LocalScript" then local a = g[i].clone() local b = p:WaitForChild("Backpack") a.Parent = p.Backpack a.Disabled = false end end end)
LocalScript:
ranks = {"Oracle", "Counselor", "Cabin Counselor", "Camp Counselor"}
local p = game.Players.LocalPlayer for i, v in pairs(ranks) do local r = p:GetRoleInGroup(781) if string.lower(r) == string.lower(v) then local m = Instance.new("Message") m.Parent = Workspace m.Text = "Welcome " ..v.. " " ..p.Name wait(5) m:Destroy() end end |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 08 Jun 2013 03:20 PM |
| And what's the problem with this? |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 08 Jun 2013 03:22 PM |
| Oh, wait, I think you should put it either in the character or the PlayerGui, not the Backpack. |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 08 Jun 2013 03:47 PM |
| I changed it to PlayerGui and nothing happened. I'm going to tweet Shedletsky and see if he knows anything about this. |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
| |
|
Voidion
|
  |
| Joined: 01 Aug 2011 |
| Total Posts: 2668 |
|
|
| 08 Jun 2013 08:01 PM |
Couldn't you do the first part with...
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character script.LocalScript:Clone().Parent = p.Backpack end) |
|
|
| Report Abuse |
|
|
HadesDude
|
  |
| Joined: 16 Feb 2009 |
| Total Posts: 11982 |
|
|
| 08 Jun 2013 08:06 PM |
| Lol, I'm not that good at cleaning my scripts up. Thank you though. |
|
|
| Report Abuse |
|
|