sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 10:19 PM |
lets say, there is checkpoints, and these checkpoints are teams. Is there a way for when they log out, it automaticly saves? Then when they log back in, no matter what server it will put them back at that team spawn point? If so, can soemone build it for me? I am willing to pay R$. |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 29 Dec 2012 10:25 PM |
TeamValue1 TeamValue2
TeamChosen,
TeamValue1 = true TeamValue2 = false
game.Players.LocalPlayer:SaveBoolean("TeamValue1", true)
TeamValue1 = false TeamValue2 = true
game.Players.LocalPlayer:SaveBoolean("TeamValue2", true)
|
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 10:28 PM |
| Would that work with more then two teams though? |
|
|
| Report Abuse |
|
|
|
| 29 Dec 2012 10:29 PM |
If you have several teams, you could just save the TeamColor they're on.
Game.Players.PlayerAdded:connect(function(Plr) Plr:WaitForDataReady() Plr.TeamColor = BrickColor.new(Color3.new(Plr:LoadNumber("RED"),Plr:LoadNumber("BLUE"),Plr:LoadNumber("GREEN"))) end)
Game.Players.PlayerRemoving:connect(function(Plr) local team = Plr.TeamColor Plr:SaveNumber("RED", team.r) Plr:SaveNumber("BLUE", team.b) Plr:SaveNumber("GREEN", team.g) end) |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 29 Dec 2012 10:30 PM |
| Thats not the script.. Just add more, if a team is chosen, save the team as soon as it is chosen. :p You can save the teamcolor if you want. |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 10:34 PM |
@Crouton Didn't work
@Kill Testing, thanks. Also, do I have to change the temacolors too the ones I have? |
|
|
| Report Abuse |
|
|
|
| 29 Dec 2012 10:36 PM |
| No, don't change anything. |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 10:39 PM |
| It does not appear to be working at all. |
|
|
| Report Abuse |
|
|
crouton04
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 4459 |
|
|
| 29 Dec 2012 10:46 PM |
| Why are you using savenumber? |
|
|
| Report Abuse |
|
|
|
| 29 Dec 2012 10:52 PM |
Because there is no "SaveBrickColor" method.
I suppose if that doesn't work, you'll have to use this:
Game.Players.PlayerAdded:connect(function(Plr) Plr:WaitForDataReady() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams) do if v.Name == team then Plr.TeamColor = v.TeamColor break end end end)
Game.Players.PlayerRemoving:connect(function(Plr) Plr:SaveString("TEAM", (function() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams) do if v.Name == team then return v.TeamColor end end end)()) end) |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
| |
|
|
| 29 Dec 2012 10:52 PM |
| Replace "Game.Teams" with "Game.Teams:GetChildren()" |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 10:59 PM |
So like this? Game.Players.PlayerAdded:connect(function(Plr) Plr:WaitForDataReady() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams) do if v.Name == team then Plr.TeamColor = v.TeamColor break end end end)
Game.Players.PlayerRemoving:connect(function(Plr) Plr:SaveString("TEAM", (function() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams:GetChildren()) do if v.Name == team then return v.TeamColor end end end)()) end)
Or this?
Game.Players.PlayerAdded:connect(function(Plr) Plr:WaitForDataReady() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams) do if v.Name == team then Plr.TeamColor = v.TeamColor break end end end)
Game.Players.PlayerRemoving:connect(function(Plr) Plr:SaveString("TEAM", (function() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams:GetChildren() do if v.Name == team then return v.TeamColor end end end)()) end) |
|
|
| Report Abuse |
|
|
|
| 29 Dec 2012 11:01 PM |
Both Game.Teams. Use this (I also corrected another mistake):
Game.Players.PlayerAdded:connect(function(Plr) Plr:WaitForDataReady() local team = Plr:LoadString("TEAM") for i, v in pairs(Game.Teams:GetChildren()) do if v.Name == team then Plr.TeamColor = v.TeamColor break end end end)
Game.Players.PlayerRemoving:connect(function(Plr) Plr:SaveString("TEAM", (function() for i, v in pairs(Game.Teams:GetChildren() do if v.Name == team then return v.Name end end end)()) end) |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 11:06 PM |
still does not work :( Le que que |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
| |
|
|
| 29 Dec 2012 11:33 PM |
| Is one of the teams AutoAssignable? |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
| |
|
|
| 29 Dec 2012 11:36 PM |
I guess that was a pretty irrelevant question. Try this:
local StartingTeamColor = "name of starting team"
Game.Players.PlayerAdded:connect(function(Plr) Plr:WaitForDataReady() local cteam = Plr:LoadString("TEAM") local team = cteam == "" and cteam or StartingTeamColor for i, v in pairs(Game.Teams:GetChildren()) do if v.Name == team then Plr.TeamColor = v.TeamColor break end end end)
Game.Players.PlayerRemoving:connect(function(Plr) Plr:SaveString("TEAM", (function() for i, v in pairs(Game.Teams:GetChildren() do if v.Name == team then return v.Name end end end)()) end) |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
| |
|
|
| 29 Dec 2012 11:38 PM |
Name... it was originally going to be color, but I changed it.
If this doesn't work, I give up. I am absolutely terrible at DataPersistance- I've never really used it before. |
|
|
| Report Abuse |
|
|
sweis12
|
  |
| Joined: 08 Feb 2013 |
| Total Posts: 2522 |
|
|
| 29 Dec 2012 11:41 PM |
| Yea, IT dosn't work. Im confused on this subject though. The script SHOULD be working. |
|
|
| Report Abuse |
|
|
Treshold
|
  |
| Joined: 01 Aug 2012 |
| Total Posts: 109 |
|
|
| 29 Dec 2012 11:50 PM |
Why not just save TeamColor.Number?
game.Players.PlayerAdded:connect(function(plr) plr:WaitForDataReady() if not plr:LoadNumber("Team") then return end plr.TeamColor = BrickColor.new(plr:LoadNumber("Team")) end)
game.Players.PlayerRemoving:connect(function(plr) plr:SaveNumber("Team",plr.TeamColor.Number) end) |
|
|
| Report Abuse |
|
|
|
| 29 Dec 2012 11:51 PM |
^
Forgot BrickColor.Number existed. qq |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2012 12:13 AM |
Or just save it as a stringvalue. Look:
game.Players.PlayerRemoving:connect(function(player) player:SaveBoolean("PBF", true) player:SaveString("Team", tostring(player.TeamColor) end)
game.Players.PlayerAdded:connect(function(player) if player:LoadBoolean("PBF") == true then player.TeamColor = BrickColor.new(tostring(player:LoadString("Team"))) end end)
- thedestroyer115 |
|
|
| Report Abuse |
|
|