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: Script Help?

Previous Thread :: Next Thread 
TinpotOps is not online. TinpotOps
Joined: 22 Jul 2012
Total Posts: 813
22 Oct 2012 02:53 PM
Script Isn't giving out an error, Trying to get it to Change a team to the specific person if they're in the group and have pressed the button:

script:
script.Parent.MouseButton1Down:connect(function()
if game.Players.LocalPlayer:IsInGroup(327807) then
game.Players.LocalPlayer.TeamColor = BrickColor.new("Bright yellow")
end
end)
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
22 Oct 2012 02:56 PM
script.Parent.MouseButton1Down:connect(function() --gui?
if game.Players.LocalPlayer:IsInGroup(327807) then
game.Players.LocalPlayer.TeamColor = "Bright yellow" --hmm maybe?
end
end)
Report Abuse
TinpotOps is not online. TinpotOps
Joined: 22 Jul 2012
Total Posts: 813
22 Oct 2012 02:58 PM
Needs brickcolor.new, just saying "bright yellow" gives a #3 error, with a brickcolor expected, instead of a string. yes it's a GUI.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
22 Oct 2012 03:01 PM
Could I see your hierarchy?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
22 Oct 2012 03:01 PM
Why not access the player with their playergui?
Report Abuse
TinpotOps is not online. TinpotOps
Joined: 22 Jul 2012
Total Posts: 813
22 Oct 2012 03:03 PM
@Xnite:

Players:
(Players)
-TinpotOps(Player)
--PlayerGui(PlayerGui)
---ChangeT(ScreenGui)
----ButtonH(Frame)
-----TGI(TextButton)
------TGI (Script)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
22 Oct 2012 03:04 PM
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(327807) then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Bright yellow")
end
end)

Check the parents.
Report Abuse
TinpotOps is not online. TinpotOps
Joined: 22 Jul 2012
Total Posts: 813
22 Oct 2012 03:07 PM
No errors in Output, Parents are correct, are you able to execute the IsInGroup method from the Players tab?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
22 Oct 2012 03:11 PM
were is this script located again?

waht's the parent of this script?
Report Abuse
SourceLeak is not online. SourceLeak
Joined: 10 Jun 2012
Total Posts: 841
22 Oct 2012 03:11 PM
@miz

If this is in a LocalScript then like the original script, you only need to use the LocalPlayer object in Players.

@tin

Is it definitely in a localscript?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
22 Oct 2012 03:11 PM
-TinpotOps(Player)
--PlayerGui(PlayerGui)
---ChangeT(ScreenGui)
----ButtonH(Frame)
-----TGI(TextButton)
------TGI (Script)

script.Parent.Parent.Parent.Parent.ChangeT.ButtonH.TGI.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent:IsInGroup(int) then
script.Parent.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("TeamColor")
end
end)

Change the parents

Change the int to the Group

Change TeamColor to the BrickColor

Report Abuse
TinpotOps is not online. TinpotOps
Joined: 22 Jul 2012
Total Posts: 813
22 Oct 2012 03:12 PM
yep it's a localscript.
Report Abuse
SourceLeak is not online. SourceLeak
Joined: 10 Jun 2012
Total Posts: 841
22 Oct 2012 03:19 PM
@miz

I'm sorry, please do not be too offended, but it has to be said before you ruin someone's scripting abilities:

You are giving horrible information. You single-handedly made that script about 5 times less efficient by messing with the hierarchy.

If you are using a *LOCAL*Script, then you can access the player it is in by referencing game.Players.LocalPlayer.

Therefore, you are making it more complicated and making the code more prone-to-error.

Please cease until you know somewhat what you are talking about. You seem new to the concept.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
22 Oct 2012 03:22 PM
int = 327807
script.Parent.MouseButton1Down:connect(function()
if LocalPlayer:IsInGroup(int) then --local player or five parents huh?
LocalPlayer.TeamColor = BrickColor.new("Bright yellow")
end
end)
Report Abuse
SourceLeak is not online. SourceLeak
Joined: 10 Jun 2012
Total Posts: 841
22 Oct 2012 03:25 PM
@Xnite
LocalPlayer doesn't exist, you need game.Players.LocalPlayer

@Tin

Apart from fixing the incorrect renditions of your script by other people, I cannot see a problem with yours.

However I remember having issues with TeamColors myself. Is this possibly a logical error rather than a syntax error?
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
22 Oct 2012 03:27 PM
Ugh I knew something was wrong.

int = 327807
script.Parent.MouseButton1Down:connect(function()
if game.Players.LocalPlayer:IsInGroup(int) then --local player or five parents huh?
game.Players.LocalPlayer.TeamColor = BrickColor.new("Bright yellow")
end
end)

or or

int = 327807
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(int) then --local player or five parents huh?
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Bright yellow")
end
end)
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