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
 

onChanged Player TeamColor

Previous Thread :: Next Thread 
TheAlaska is not online. TheAlaska
Joined: 21 Jan 2011
Total Posts: 152
28 Jun 2016 12:35 PM
So this script gets inserted into every Player that joins the map

function onChanged(changed)
if script.Parent.TeamColor == game.Lighting.Team1.Value then
script.Parent.TribeValue.Value = 1
end
end
script.Parent.TeamColor.Changed:connect(onChanged)

Except when the Player's TeamColor changes, nothing happens.
Report Abuse
BaconOfDeath is not online. BaconOfDeath
Joined: 15 Jan 2013
Total Posts: 134
28 Jun 2016 12:48 PM
try temporarily putting more noticeable things in the onChanged function to see if it is actually being run. if it is, then the problem lies within the code for the function.
for example:
function onChanged(changed)
print'color changed!'
end
end
script.Parent.TeamColor.Changed:connect(onChanged)

if run it you see "color changed!" in the output, then something is wrong with the function's code.
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
28 Jun 2016 12:50 PM
Is the 'Team1' object a BrickColorValue?
Report Abuse
TheAlaska is not online. TheAlaska
Joined: 21 Jan 2011
Total Posts: 152
28 Jun 2016 12:54 PM
Yes it's a brickcolor value

--

The function isn't connecting at all.
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
28 Jun 2016 12:56 PM
Oh whoops, I see what it is now. There isn't a Changed event for the TeamColor property. However, the Player does have a a Changed event. You'll just have to check and see what was changed by doing something like this.

script.Parent.Changed:connect(function(changedproperty)
if not (changedproperty == 'TeamColor') then return end
-- code here
end)
Report Abuse
TheAlaska is not online. TheAlaska
Joined: 21 Jan 2011
Total Posts: 152
28 Jun 2016 01:28 PM
clone = game.ServerScriptService.VoteGui:Clone()

function onclick(clicker)
if game.Workspace[clicker.Name].Head.VoterValue.Value == false then
game.Workspace[clicker.Name].Head.VoterValue.Value = true
clone:Clone().Parent = game.Players[clicker.Name].PlayerGui
end
end
script.Parent.ClickDetector.MouseClick:connect(onclick)


Did I do something wrong here?
It's still not working.
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