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 » Scripters
Home Search
 

Re: Simplifying a string

Previous Thread :: Next Thread 
OdardAkari is not online. OdardAkari
Joined: 16 Jun 2012
Total Posts: 1235
24 Apr 2016 05:36 PM
Could something like "script.Parent.Parent.Parent" be simplified to what it's referring to? Like "ServerStorage"?

Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
24 Apr 2016 05:38 PM
local serverstorage = script.Parent.Parent.Parent
Report Abuse
OdardAkari is not online. OdardAkari
Joined: 16 Jun 2012
Total Posts: 1235
24 Apr 2016 08:09 PM
What I actually want to do is make a team change GUI. In the one I'm using to make sure I got it right (I'm a beginner scripter, so I make the scripts myself then use another script to check it) it's referring to the player as "script.Parent.Parent.Parent.Parent.Parent". How would I simplify this? Would a simple variable do the trick?

Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
24 Apr 2016 08:12 PM
These would be better for the Player instead of Player = script.Parent.Parent.Parent

If you have a local script

local Player = game.Players.LocalPlayer

if it is in a script

game.Players.PlayerAdded:connect(function(Player)
--Do stuff here with the Player
end)
Report Abuse
OdardAkari is not online. OdardAkari
Joined: 16 Jun 2012
Total Posts: 1235
24 Apr 2016 08:13 PM
Player = script.Parent.Parent.Parent.Parent.Parent

function Click(mouse)
if Player:IsInGroup(2816341) then
Player.TeamColor = BrickColor.new("Burnt Sienna")
end
end

This is what I have right now.

Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
24 Apr 2016 08:16 PM
I told you not to set your player has
Player = script.Parent.Parent.Parent.Parent.Parent

x)
Report Abuse
OdardAkari is not online. OdardAkari
Joined: 16 Jun 2012
Total Posts: 1235
24 Apr 2016 08:17 PM
So it should be
game.Players.PlayerAdded:connect(function(Player)
function Click(mouse)
if Player:IsInGroup(2816341) then
Player.TeamColor = BrickColor.new("Burnt Sienna")

Or does it need to be different from this?

Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
24 Apr 2016 08:20 PM
I saw your other thread and I answered it m8.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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