generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: LocalScript question

Previous Thread :: Next Thread 
HadesDude is not online. 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 is not online. HadesDude
Joined: 16 Feb 2009
Total Posts: 11982
07 Jun 2013 10:58 PM
Anyone?
Report Abuse
Desperian is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. HadesDude
Joined: 16 Feb 2009
Total Posts: 11982
08 Jun 2013 12:21 AM
Anyone else?
Report Abuse
Desperian is not online. 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 is not online. 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 is not online. HadesDude
Joined: 16 Feb 2009
Total Posts: 11982
08 Jun 2013 11:26 AM
Bump
Report Abuse
getkoed2 is not online. 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 is not online. HadesDude
Joined: 16 Feb 2009
Total Posts: 11982
08 Jun 2013 11:31 AM
I've tried that :/
Report Abuse
getkoed2 is not online. 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 is not online. 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 is not online. getkoed2
Joined: 11 Apr 2010
Total Posts: 1144
08 Jun 2013 03:20 PM
And what's the problem with this?
Report Abuse
getkoed2 is not online. 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 is not online. 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 is not online. HadesDude
Joined: 16 Feb 2009
Total Posts: 11982
08 Jun 2013 07:57 PM
Anyone else?
Report Abuse
Voidion is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image