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
 

Change team on GUI click

Previous Thread :: Next Thread 
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
17 Jun 2014 05:31 AM
Well what this script does is it puts the player in the team once they clicked the GUI and they are in the group. But the problem is I don't know how to actually do that properly and here is my failed attempt:


function onClick()
if script.Parent.Parent.Parent.Parent:IsInGroup(1019299) then
script.Parent.Parent.Parent.Parent.Neutral = false
script.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Bright blue")
end
end

script.Parent.MouseButton1Click:connect(onClick)






Just so you know I have it set up like this:

Starter GUI
-screen gui
--text button
---This script
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
17 Jun 2014 05:33 AM
I'v failed horribly haven't I.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
17 Jun 2014 05:57 AM
Nvm. I'v managed to make it work. with this script:



local TeamColor = game.Teams["TeamNameHere"].TeamColor


function onClick()
if script.Parent.Parent.Parent.Parent:IsInGroup(GroupIDHere) then
script.Parent.Parent.Parent.Parent.Neutral = false
script.Parent.Parent.Parent.Parent.TeamColor = TeamColor
end
end

script.Parent.MouseButton1Click:connect(onClick)





(It obviously it has the "groupidhere" and "teamnamehere" bits filled out for the actual thing)
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
17 Jun 2014 08:08 AM
Let's simplify, shall we?
In a local script



script.Parent.MouseButton1Click:connect(function()
if game.Players.LocalPlayer:IsInGroup(1019299) then
game.Players.LocalPlayer.TeamColor = BrickColor.new('Bright blue')
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